C++ Boost

Writable Property Map

A Writable Property Map has the capability of setting the value object associated with the given key object via the put() function.

Refinement of

Copy Constructible

Notation

PMap A type that is a model of Writable Property Map.
pmap An object of type PMap.
key An object of type boost::property_traits<PMap>::key_type.
val An object of type boost::property_traits<PMap>::value_type.

Associated Types

Value Type boost::property_traits<PMap>::value_type The type of the property.
Key Type boost::property_traits<PMap>::key_type The type of the key object used to look up the property. The property map may be templated on the key type, in which case this typedef can be void.
Property Map Category boost::property_traits<PMap>::category The category of the property: a type convertible to writable_property_map_tag.

Valid Expressions

NameExpressionReturn TypeDescription
Put Property Value[1] put(pmap, key, val) void Assign val to the property associated with k.

Notes

[1] The function put() was originally named set(), but was changed to avoid name conflicts with the std::set class when using a compiler (Microsoft Visual C++) with non-standard name lookup rules. The following example demonstrates the problem.
#include <set>
using namespace std;
namespace boost {
  void set() { }
}

Concept Checking Class

  template <class PMap, class Key>
  struct WritablePropertyMapConcept
  {
    typedef typename property_traits<PMap>::key_type key_type;
    typedef typename property_traits<PMap>::category Category;
    typedef boost::writable_property_map_tag WritableTag;
    void constraints() {
      function_requires< ConvertibleConcept<Category, WritableTag> >();
      put(pmap, k, val);
    }
    PMap pmap;
    Key k;
    typename property_traits<PMap>::value_type val;
  };

See Also

Property map concepts

Copyright © 2000 Jeremy Siek, Univ.of Notre Dame ([email protected])