Boost logo

Boost Users :

Subject: [Boost-users] [MPL] for_each help needed
From: Manuel Jung (gzahl_at_[hidden])
Date: 2008-10-06 04:12:24


Hey,

I have problems using mpl::for_each. Well, it works for simple functors, but
i need a functor with some context. I'm trying to build a functor through
boost::bind. mpl::_1 should be a type from the consensus sequence if
evaluated, shouldn't it? You can see a small (hopefully not too small)
example below.

Kind Regards
Manuel

class filter{
        //[..]
        // "In" and "Out" are fusion::maps

        template< typename T >
        inline const boost::promise_stream<T>& get_promise(){
                return fusion::at_key< T >(Out);
        };

        template< typename T >
        inline void connect(const boost::promise_stream<T> &promise){
                fusion::at_key< T >(In).reset(new boost::future_stream< T >(promise));
        };

        template< typename producer_type >
        void connect(producer_type Producer){

        //[..]
        // "consensus" is a mpl sequence.

        mpl::for_each< consensus >(boost::bind(&producer_type::connect, Producer,
get_promise< mpl::_1 >()));
        };
                


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