correct usage of bind (pls ignore last email)
Hi,
The code below tries to chain function ft1 (argument is a pair) with
function buildPair (returns a pair).
template
AMDG Sandeep Gupta wrote:
template
std::pair buildPair(X x, Y y); int main() { typedef boost::function
)> FuncType1_t; FuncType1_t ft1; typedef boost::function
)> FuncType2_t; FuncType2_t ft2 = bind(ft1, bind(buildPair ,_1,_2)); } This fails. The problem however vanished if I replace the declaration "FuncType3 ft2..." with bind(ft1, bind(buildPair
,_1,_2))(3,5); So my question is what is correct type of bind(ft1, bind(buildPair
,_1,_2));
Since it is a function which takes two ints,
the correct type is
boost::function
That is indeed so. Thanks Steve.
On Tue, Mar 17, 2009 at 3:40 PM, Steven Watanabe
AMDG
Sandeep Gupta wrote:
template
std::pair buildPair(X x, Y y); int main() { typedef boost::function
)> FuncType1_t; FuncType1_t ft1; typedef boost::function
)> FuncType2_t; FuncType2_t ft2 = bind(ft1, bind(buildPair ,_1,_2)); } This fails. The problem however vanished if I replace the declaration "FuncType3 ft2..." with bind(ft1, bind(buildPair
,_1,_2))(3,5); So my question is what is correct type of bind(ft1, bind(buildPair
,_1,_2)); Since it is a function which takes two ints, the correct type is
boost::function
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Sandeep Gupta
-
Steven Watanabe