| | | | | |

Chaining

template < class Fun1 , class Fun2 >
Fun2 Chain(const Fun1& fun1, const Fun2& fun2)
{
  return Fun2
    (
      std::auto_ptr<typename Fun2::Impl>(new Chainer<Fun1, Fun2>(fun1, fun2))
    );
}
// returns a "Chainer" object that stores fun1 and fun2 
// and overloads operator() to call them sequentially 

| | Top of Page | 8. Generalized Functors - 22 of 26