
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

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
participants (2)
-
Roman Perepelitsa
-
Sandeep Gupta