Boost logo

Boost Users :

Subject: [Boost-users] correct usage of bind
From: Sandeep Gupta (gupta.sandeep_at_[hidden])
Date: 2009-03-17 17:54:49


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<typename X, typename Y>
std::pair<X, Y> buildPair(X x, Y y)
{
  std::pair<X,Y> apair(x,y);
  return apair;
}

(std::cout<<buildPair(_1,_2).first<<' ')(1,2); ///--compiles fine---------
(bind(buildPair,_1,_2))(3,5); ///-fails------------

Thanks
sandeep


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