fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <algorithm>
  4. #include <vector>
  5. #include <iterator>
  6. #include <boost/bind.hpp>
  7. int f() { return rand(); }
  8. int main()
  9. {
  10. std::vector<int> v(10);
  11. transform(v.begin(), v.end(), v.begin(), boost::bind(f));
  12. copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "));
  13. std::cout << '\n';
  14. }
Success #stdin #stdout 0s 2856KB
stdin
Standard input is empty
stdout
1804289383 846930886 1681692777 1714636915 1957747793 424238335 719885386 1649760492 596516649 1189641421