|
Boost : |
Subject: Re: [boost] Boost.Convert+Boost.Parameter
From: Vladimir Batov (batov_at_[hidden])
Date: 2009-02-24 04:04:34
>> convert<string, int>(str, default_ = -1)
>>
> No. That assignment doesn't assign a variable; it creates a binding.
Dave, I am glad you are confident there is no MT issue here. Apologies for
being somewhat obtuse but what I see is
namespace convert
{
BOOST_PARAMETER_NAME(value)
}
results in
namespace convert
{
namespace tag { struct value; } // keyword tag type
namespace // unnamed
{
// A reference to the keyword object
boost::parameter::keyword<tag::value>& _value
= boost::parameter::keyword<tag::value>::get();
}
}
My interpretation of the code above that it is a declaration of "_value" as
a reference. Then, I call the same thing twice as below:
convert<string, int>(str, _value = -1);
convert<string, int>(str, _value = -2);
Does not the *same* _value reference is used in *both* calls? I.e. after the
first call "_value" references -1 and after the second call it
references -2. If so, then, when two calls above called from different
threads we might have a problem, isn't it? If it is not the case, I am
really curious how you, guys, did that, it is surely looks magic. Any
pointers, additional docs, anything?
Thanks,
V.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk