
Arkadiy Vertleyb writes:
Hi Sasha :)
Why "(other)"? I believe they are the same in the same TU...
Now I see. In 7.3.1.1: An unnamed namespace definition behaves as if it were replaced by namespace unique { /* empty body */ } using namespace unique; namespace unique { namespacebody } where all occurrences of *unique* in a translation unit are replaced by *the same identifier* and this identifier differs from all other identifiers in the entire program. Somehow I missed *the same identifier*. How could I ever program for years without knowing this?
namespaces. Is it intentional?
Yes.
Automatic ID generation leads to potential ODR violation, since, depending on the order of inclusion, the same template specializations can be generated with different IDs, and therefore with different bodies. This was workarounded by placing them into anonimous namespaces, so that thay are different in different TU, and so not the subject to ODR. [skiped] This question was discussed in the past, and it was decided that we can live with this as long as we have a specific test that verifies that compilers don't really care. We have such test, and at some point Martin Wille helped me by running it on como, which is considered to be the most strict compiler. Of course it's also a part of our regular test.
Yeah, I remember this discussion. One idea came to my mind. In order to avoid ODR violations, can we switch from definitions to declarations? Every BOOST_TYPEOF_REGISTER_TYPE macro could add overloaded reg_entry function which encodes a given type T: template<class T> char (& reg_entry(identity<T>) ) [CODE1][CODE2] ... [CODE50]; [skiped]
I don't know how noticable this is in the current doc, though.
I don't care much about a quality of documenation for now. Lack of it may be even better because it could protect from overusing the library. This reminds me of the fact that a first version of MPL was introduced inofficially. Thanks Arkadiy and Peder for great library! -- Alexander Nasonov