
Such a specialization (complete or partial) of a standard library template results in undefined behavior
Hmmm - not getting this. How does specialization result in undefined behavior. The whole purpose of specialization is to define behavior. Does this mean to say that any declared specialization should be defined or what?
unless the declaration depends on a user-defined name of external linkage
[snip]
and unless the specialization meets the standard library requirements for the original template."
[snip]
I think the second part just means that the compiler/library can assume that all specializations of a standard library template meet the requirements for the template (assuming of course that the main definition in the library does), and so if you provide a specialization that does not meet the requirements, the resulting behaviour is undefined. For example, a requirement of std::swap is that it has the effect of exchanging the values stored in two variables passed to it. You can specialize std::swap for some custom type Foo, but if that specialization does not meet the requirement (i.e. it does not exchange the values), then undefined behaviour could result (for example, an algorithm that uses std::swap could get into an infinite loop). I'm not sure what is the purpose of the first part (about linkage). Regards, Nate