18 Mar
2009
18 Mar
'09
8:07 a.m.
2009/3/17 Sandeep Gupta
Hi, Both the statements below bind function buildPair. While the first works the other fails. What could be a possible fix. Thanks in advance.
//---- Function to be used by bind ------------------------- template
std::pair buildPair(X x, Y y) { std::pair apair(x,y); return apair; } (std::cout<
This one does not bind buildPair, it evaluates buildPair immediately. This line of code is equivalent to (std::cout<<_1<<' ')(1,2);
(bind(buildPair,_1,_2))(3,5); ///-fails------------
You should specify template arguments for buildPair.
(bind(buildPair