Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2004-11-24 20:28:57


Darren Cook wrote:
>> Hi. Here's a preview of Phoenix V2. ...
>> You can browse the draft docs here:
>> http://tinyurl.com/6crgp
>
>
> Hi Joel,
> It looks interesting. I've only read the Starter Kit page so far. You
> went from this (without using the library):
> find_if(c.begin(), c.end(), &is_odd)
>
> To:
> find_if(c.begin(), c.end(), is_odd(arg1));

Actually, it's this:

     bool
     is_odd(int arg1)
     {
         return arg1 % 2 == 1;
     }

     find_if(c.begin(), c.end(), &is_odd)

to this:

     find_if(c.begin(), c.end(), arg1 % 2 == 1)

You seem to have missed that. It's easy to miss because it's shorter.
http://tinyurl.com/6h4xr

> But your functor is a lot longer, and the advantage wasn't explained (or
> perhaps what I mean is that the advantage of lazy evaluation wasn't
> explained or demonstrated here).
>
> Is it any quicker to run? If the advantage is that you get better
> re-use, then I think you need a follow-on example that shows that
> re-use, and how that wouldn't be achieved with normal c++ functors.

I can't explain eveything in the starter kit. It's explained in
latter parts of the doc: http://tinyurl.com/6kpcn. The starter
kit is meant to be as concise as possible.

However, the fact that you mentioned it makes me want to improve
on it. Any suggestion is very welcome.

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