From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2007-06-14 12:05:13
Arkadiy Vertleyb wrote:
> "Douglas Gregor" <dgregor_at_[hidden]> wrote
>> That's fine, so long as the template is not instantiated differently in
>> different translation units.
> And, since the instantiation itself is done by the library user, and the
> library author can't know how it will be done, this technique must be
> prohibited according to ODR.
The ODR doesn't prohibit techniques, merely occurrences.
If the library specializes the template for its types, then it should do
so in a way that the specialization is visible whenever the type is
visible. Otherwise, yes, ODR can occur.
Or, if the library doesn't want to introduce the unavoidable dependency,
it should document very clearly that, in order to use both this library
and the library providing the template, the client must include the
header that provides the specialization.
But this doesn't make the technique invalid.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk