home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C21 / Binder3.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  667 b   |  25 lines

  1. //: C21:Binder3.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Binders aren't limited to producing predicates
  7. #include "Generators.h"
  8. #include <algorithm>
  9. #include <vector>
  10. #include <iostream>
  11. #include <functional>
  12. using namespace std;
  13.  
  14. int main() {
  15.   ostream_iterator<int> out(cout, " ");
  16.   vector<int> v(15);
  17.   generate(v.begin(), v.end(), URandGen(20));
  18.   copy(v.begin(), v.end(), out);
  19.   cout << endl;
  20.   transform(v.begin(), v.end(), v.begin(),
  21.     bind2nd(multiplies<int>(), 10));
  22.   copy(v.begin(), v.end(), out);
  23.   cout << endl;
  24. } ///:~
  25.