Boost logo

Boost :

Subject: Re: [boost] Boost.Convert+Boost.Parameter
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-02-24 11:41:48


AMDG

Vladimir Batov wrote:
> 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?

Assignment is overloaded to return an argument pack rather than storing
the value in a global location. Everything you need is encoded in the
return
type of _value = -1. the actual object _value is stateless.

In Christ,
Steven Watanabe


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