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:
> 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:

     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.

> 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: 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.


Joel de Guzman

Boost list run by bdawes at, gregod at, cpdaniel at, john at