Boost logo

Boost :

From: Korcan Hussein (korcan_h_at_[hidden])
Date: 2008-02-20 10:05:59


Sorry about the poor title, it is difficult for me to explain the
problem without code so here is a really simple example of what i'm
trying to achieve but fails to compile with Boost.Bind:

#include <boost/bind.hpp>

struct FunFn {

        typedef void result_type;
        template < typename Fun >
        void operator()(Fun fn) const {
                fn();
        }

} const Fn;

void g() { std::cout << "hello\n"; }

int main() {
        using namespace boost;

        bind(Fn, bind(Fn, bind(Fn, bind(Fn, ... bind(Fn, g))();

}

I get type deduction errors, however i have found workaround using
Boost.Function for the time being:

#include <boost/function.hpp>

...
boost::function< void () >
        fnN = bind(Fn, g),
        fnN-1 = bind(Fn, fnN),
        ...,
        fn1 = bind(Fn, fn2),
        fn = bind(Fn, fn1);

bind(Fn, fn)();


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