Boost logo

Boost :

Subject: Re: [boost] New libraries implementing C++11 features in C++03
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-11-25 09:40:23


On 11/25/2011 10:26 PM, Christopher Jefferson wrote:
>
> On 25 Nov 2011, at 14:04, Joel de Guzman wrote:
>
>> On 11/25/2011 9:58 PM, Joel de Guzman wrote:
>>>
>>>> In the past I tried turning this into phoenix code, and failed. I'd be genuinely
>>> interested to know what it would look like as a phoenix function.
>>>
>>> Here's the phoenix functions rendition of that:
>>>
>>> http://pastebin.com/QWnHiKkv
>>
>> Oops, T1 should be a reference. One more try:
>>
>> http://pastebin.com/dcriF8FA
>
> Thank you, but I was thinking more doing the whole thing in-line (else, I would just
> write a function object, much like you did, without the phoenix), or use std::bind.
>
> Of course, it might be the case that writing that inline is just more pain than it is
> worth. Certainly it would get a bit long hanging off a for-each!

Well, the point of the exercise is to use "statement syntax",
just as you did using Locals. By doing so, you lessen the chance
of having "outrageous error messages" and minimize compile time.

There are advantages with phoenix functions over plain function
objects, but I do not want to digress. At the very least, you
have easy binding of locals. Also, it's just as succinct and
clear as your Locals version.

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://boost-spirit.com

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