example3.cpp 564 B

123456789101112131415161718192021
  1. // Copyright Vladimir Prus 2003.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt
  4. // or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/property_map/vector_property_map.hpp>
  6. #include <string>
  7. #include <iostream>
  8. int main()
  9. {
  10. boost::vector_property_map<std::string> m;
  11. // Assign string to '4'.
  12. m[4] = "e";
  13. std::cout << "'" << m[4] << "'\n";
  14. // Grab string from '10'. Since none is associated,
  15. // "" will be returned.
  16. std::cout << "'" << m[10] << "'\n";
  17. }