C++ Boost

Readable Property Map

A Readable Property Map provides the get() function to obtain the value associated with a key.

Refinement of

Copy Constructible

Notation

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

Associated Types

Value Type boost::property_traits<PMap>::value_type  
Key Type boost::property_traits<PMap>::key_type  
Reference Type boost::property_traits<PMap>::reference value_type must be constructible by reference.
Property Map Category boost::property_traits<PMap>::category Must convertible to boost::readable_property_map_tag.

Valid Expressions

NameExpressionReturn TypeDescription
Get Property Value get(pmap, key) boost::property_traits<PMap>::reference Lookup the value associated with key.

Concept Checking Class

  template <class PMap, class Key>
  struct ReadablePropertyMapConcept
  {
    typedef typename property_traits<PMap>::key_type key_type;
    typedef typename property_traits<PMap>::category Category;
    typedef boost::readable_property_map_tag ReadableTag;
    void constraints() {
      function_requires< ConvertibleConcept<Category, ReadableTag> >();

      val = get(pmap, k);
    }
    PMap pmap;
    Key k;
    typename property_traits<PMap>::value_type val;
  };

See Also

Property map concepts - Writable Property Map - Read / Write Property Map - Lvalue Property Map - Mutable Lvalue Property Map

Design Notes

At various times the name "read-only" was considered for this concept. However, that name is inappropriate because concepts are inherently positive, not negative. This becomes obvious when we define the Read Write Property Map, which refines both the Readable Property Map and the Writable Property Map concept. It would not make much sense to combine "read-only" and "write-only" concepts!

Copyright © 2000-2012 Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu)
Alex Hagen-Zanker