Boost logo

Boost Users :

From: Hansi (hansipet_at_[hidden])
Date: 2008-06-12 05:31:51


Hello,

at the moment I'm reading the documentation from Phoenix. Now I have
read in the first pages that there are 2 possibilities to define a functor
1)
find_if(c.begin(), c.end(), arg1 % 2 == 1)

2)
struct is_odd_ {

         template <typename ArgT>
         struct result { typedef bool type; };

         template <typename ArgT>
         bool operator()(ArgT arg1) const
         { return arg1 % 2 == 1; }
     };

     function<is_odd_> is_odd;

Okay this 2 possibilities I understand. But There is also written that
for much more complex functions the second possibility is more
efficient. Can anyone say why this is more efficient?

Best regards
Hansjörg


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net