|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-11-04 11:55:20
Joel de Guzman <joel_at_[hidden]> writes:
> Comments, feedback very welcome!
Here are some sample preset definitions of arg1..argN
actor<argument<0> > const arg1 = argument<0>();
actor<argument<1> > const arg2 = argument<1>();
actor<argument<2> > const arg3 = argument<2>();
and its BLL_1.._N style counterparts:
You shouldn't use the BLL abbrev., especially not without introducing
it first. I suggest "Boost.Lambda"
actor<argument<0> > const _1 = argument<0>();
actor<argument<1> > const _2 = argument<1>();
actor<argument<2> > const _3 = argument<2>();
Have you considered the ODR/initialization order implications of
this?
Eric and I have been discussing this in another context, and it seems
to us that you have a choice:
1. The placeholders are statically initialized const POD objects in
an unnamed namespace and you have likely ODR violation when used
by templates in multiple translation units.
2. The placeholders are dynamically initialized references in an
unnamed namespace and you risk undefined behavior when they are
used without initialization due to initialization order issues
3. The placeholders are dynamically initialized objects in an unnamed
namespace, and you have likely ODR violation *and* initialization
order issues
Seems from the doc like you have #3, which is the worst of both
worlds. No?
-- Dave Abrahams Boost Consulting 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