Boost logo

Boost :

From: Joel (djowel_at_[hidden])
Date: 2005-01-10 05:07:14


David Abrahams wrote:
> Aleksey Gurtovoy wrote:
>
>>>>Any particular reason why you decided against implicit scoping along
>>>>the lines of
>>>>
>>>> for_each( _1, push_back(_1, outer(_2)) )
>>>>
>>>>?
>>>
>>>It doesn't generalize all that well, FWIW.
>>
>>Of course it does.
>>
>>
>>>What if you have to go out
>>>by 2 scopes?
>>
>> outer( outer(_2) )
>>
>>or
>> outer<2>(_2)
>>
>>
>>All this is discussed in the conversation I posted earlier -- in which
>>you participated ;).
>
>
> Yeah, it was just hard to read for the aforementioned reason.

I forgot to mention that the "outer" solution has another
drawback: it is more expensive. We have to make a full copy of
the entire arguments tuple of each scope outwards. With the
local vars solution, you only use what you need.

I know, I know :), yes you can also make "outer" only get what
it needs by inspecting the scopes. But that involves a lot of
compile time processing for little gain. Implementation wise,
the local variables solution gives more bang for the buck. I'm
still unsure if we need two ways to do things. That might be a
reason why I hesitated to doc the "outer" stuff.

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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