C++ Boost

LvaluePropertyMap

The LvaluePropertyMap provides operator[] and function get() for accessing a reference to a value object. The return type refines that of function get()in ReadablePropertyMap; it can only be a reference (for a mutable LvaluePropertyMap) or a const reference (for a non-mutable LvaluePropertyMap).

Refinement of

ReadablePropertyMap for non-mutable or ReadWritePropertyMap for mutable property map.

Notation

PMap A type that is a model of LvaluePropertyMap.
pmap An object of type PMap.
key An object of type boost::property_traits<PMap>::key_type.

Associated Types

Reference Type boost::property_traits<PMap>::reference The reference type, which must be a reference or const reference to the value type of the property map.
Property Map Category boost::property_traits<PMap>::category The category of the property: a type convertible to boost::lvalue_property_map_tag.

Valid Expressions

NameExpressionReturn TypeDescription
Access Property Value pmap[key] value_type& for mutable, const value_type& otherwise. Obtain a reference to the value associated with key.

Concept Checking Class

  template <class PMap, class Key>
  struct LvaluePropertyMapConcept
  {
    typedef typename property_traits<PMap>::category Category;
    typedef boost::lvalue_property_map_tag LvalueTag;
    typedef const typename property_traits<PMap>::value_type& const_reference;
    void constraints() {
      function_requires< ReadWritePropertyMapConcept<PMap, Key> >();
      function_requires< ConvertibleConcept<Category, LvalueTag> >();

      const_reference ref = pmap[k];
    }
    PMap pmap;
    Key k;
  };

  template <class PMap, class Key>
  struct Mutable_LvaluePropertyMapConcept
  {
    typedef typename property_traits<PMap>::category Category;
    typedef boost::lvalue_property_map_tag LvalueTag;
    typedef typename property_traits<PMap>::value_type& reference;
    void constraints() { 
      function_requires< ReadWritePropertyMapConcept<PMap, Key> >();
      function_requires<ConvertibleConcept<Category, LvalueTag> >();

      reference ref = pmap[k];
    }
    PMap pmap;
    Key k;
  };

See Also

Property map concepts

Copyright © 2000 Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu)