Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

C++, can not copy 2 vectors to vector of pair

By: a guest on Jan 19th, 2012  |  syntax: C++  |  size: 0.48 KB  |  views: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <vector>
  2. #include <map>
  3. #include <algorithm>
  4.  
  5.  
  6. struct Item { double a, b; Item (double a_, double b_): a(a_), b(b_){}};
  7. typedef std::pair <double, Item> TPair;
  8. typedef std::vector <TPair> TData;
  9.  
  10.  
  11. int main(int argc, char* argv[])
  12. {
  13.     std::vector <double> t1;
  14.     std::vector <Item> t2;
  15.  
  16.     TData data;
  17.  
  18.     //Error
  19.     std::transform (t1.begin(), t1.end(), data.begin(),
  20.          std::bind2nd( std::ptr_fun( std::make_pair <double,Item > ), Item(0,0) ) );
  21. }
clone this paste RAW Paste Data