Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 32,529 of 33,346    |
|    =?windows-1252?Q?Daniel_Kr=FCgler?= to All    |
|    Re: Is this kind of static polymorphism     |
|    05 Sep 12 16:50:44    |
      From: daniel.kruegler@googlemail.com              Am 06.09.2012 00:02, schrieb DeMarcus:       > On 2012-09-05 09:48, Daniel Krügler wrote:       >> [2nd attempt after 24 hours]              [..]              > It also seems that this elaborated-type-specifier can have the same       > name in different cpp files without getting 'multiple definitions'       > during linkage (I found the following).       >       > §3.3.2/6 saying "-for an /elaborated-type-specifier/ of the form       > /class-key identifier/ if the /elaborated-type-specifier/ is used in       > [..] otherwise, except as a friend declaration, the identifier is       > declared in the smallest namespace or block scope that contains the       > declaration.       >       > Is my interpretation of the standard correct if I say that as long as       > the template is declared in an unnamed namespace then I can do the       > specialization with the same elaborated-type-specifier name as in       > another file (more or less the same as with variable names, right)?              As the wording says: The name of the type is declared in the unnamed       namespace. These are required to be unique for different translation       units, so if you have only one such variable definition and template       specialization definition per translation unit, this is well-defined.              > Also another question I have is why I can't put the specialized       > runTests() function within the unnamed namespace as well?              The language requires that a specialization needs to be provided in the       same namespace as the namespace of the original (primary) template       ([temp.expl.spec] p2). In your example, template MyTestFixture is       defined in the global namespace, this means any specialization              template<>       void MyTestFixture |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca