C++ Boost

LvaluePropertyMap

The LvaluePropertyMap provides an interface for accessing a reference to a property object (instead of a copy of the object as in the get() function required by ReadablePropertyMap). An LvaluePropertyMap can be mutable or non-mutable. The mutable LvaluePropertyMap returns a reference whereas the non-mutable returns a const reference.

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 typeof 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 property identified by 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 ([email protected])