Subject: Re: [boost] [local_function] any interest in a LocalFunction library?
From: Pierre Morcello (pmorcell-cppfrance_at_[hidden])
Date: 2010-09-16 18:32:27
> Lorenzo Caminiti wrote :
> I have decided to provide a single block macro
> which allows to bind both const and non const so the users
> can decide
> which bound variables need to be cons within the block and
> which do
> not. If you want a pure const-block then you'll simply bind
> variable as `const&`. Blocks of course execute in-place
> right where
> they are defined. I have also kept the block break feature
> via the
> macro `BOOST_LOCAL_BLOCK_BREAK` (you get a compiler error
> if you just
> try to use `return`).
I would have prefered to see the FUNCTION + 'return' personnally.
But, I think I get your point : local unnamed macro function can be generated easily from your local named function. I made some tests to check and this seems ok for me, as long as several local classes can share the same name in a function.
Here is an example of what I mean :
something.that = 1;
something.those = "";
This use 2 local classes with the same name. It did compile under VS2008, however is it tolerated in C++ standard ?
If not, I would prefer that you provide an unnamed local function macro which does not require the user to write once more the name of the function in LOCAL_FUNCTION_END(nameOfTheFunction). This is doable (see the first code I sent you), and would allow to write the name of the function only once, and not require it several times as in your actual LOCAL_FUNCTION macros.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk