iterator-property-map-eg.cpp 740 B

123456789101112131415161718192021
  1. //=======================================================================
  2. // Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See
  5. // accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //=======================================================================
  8. #include <iostream>
  9. #include <boost/property_map/property_map.hpp>
  10. int
  11. main()
  12. {
  13. using namespace boost;
  14. double x[] = { 0.2, 4.5, 3.2 };
  15. iterator_property_map < double *, identity_property_map, double, double& > pmap(x);
  16. std::cout << "x[1] = " << get(pmap, 1) << std::endl;
  17. put(pmap, 0, 1.7);
  18. std::cout << "x[0] = " << pmap[0] << std::endl;
  19. return 0;
  20. }