Boost logo

Boost Users :

Subject: Re: [Boost-users] correct usage of bind (pls ignore last email)
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-03-17 18:40:57


Sandeep Gupta wrote:
> template<typename X, typename Y>
> std::pair<X, Y> buildPair(X x, Y y);
> int main()
> {
> typedef boost::function<void (std::pair<int,int>)> FuncType1_t;
> FuncType1_t ft1;
> typedef boost::function<void(std::pair<int,int>)> FuncType2_t;
> FuncType2_t ft2 = bind(ft1, bind(buildPair<int,int>,_1,_2));
> }
> This fails. The problem however vanished if I replace the declaration
> "FuncType3 ft2..." with
> bind(ft1, bind(buildPair<int,int>,_1,_2))(3,5);
> So my question is what is correct type of bind(ft1,
> bind(buildPair<int,int>,_1,_2));

Since it is a function which takes two ints,
the correct type is

boost::function<void(int, int)>

In Christ,
Steven Watanabe

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at