Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-07-10 10:26:06


David Abrahams <dave <at> boost-consulting.com> writes:

> Rene Rivera <grafik.list <at> redshift-software.com> writes:
>
> It's an ODR thing. If you then use the parameter names in a function
> template that's not in an unnamed namespace but _is_ in multiple TU's,
> you have technically violated the ODR.
>
> In general, types in header files had better stay out of the unnamed
> namespace.

In fact, it looks like to be really safe from ODR violations we need
to require the keyword objects to be declared as _references_ in the
unnamed namespace using the unique_instance trick, per
http://thread.gmane.org/gmane.comp.lib.boost.devel/126455
because a function template using named parameters and instantiated
in different translation units might otherwise use different objects.
It's very tempting to ignore this problem, because IMO it will *never*
cause a problem in practice, and because it complicates the usage and
documentation of the parameter library. We also need someplace to
put unique_instance. It's too general to go in boost::parameter and
it's not suitable for boost::detail since users have to touch it.

Any helpful ideas about all this would be appreciated, especially if
you can find standard text that makes it all go away ;-)

For more context, please see my Nov 16th reply to Rene in
http://thread.gmane.org/gmane.comp.lib.boost.devel/113158
GMane's posting nanny won't let me quote very much.

--
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk