Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
C++ Boost

property<PropertyTag, T, NextProperty>

This class can be used with the adjacency_list and the adjacency_matrix classes to specify what kind of properties should be attached to the vertices and edges of the graph, and to the graph object itself.


namespace boost {
  template <class Tag, class T, class NextProperty = no_property>
  struct property : public NextProperty {
    typedef NextProperty next_type;
    typedef Tag tag_type;
    typedef T value_type;
    property(const T& v);
    property(const T& v, const NextProperty& b);
    // copy constructor and assignment operator will be generated by compiler
    T m_value;

Template Parameters

PropertyTag A type to identify (give a unique name to) the property. There are several predefined tags, and it is easy to add more. For convenience, BGL also provides predefined objects of the tag types (enum values) for use as arguments to functions that expect property tag objects (such as adjacency_list's property map accessor functions).  
T This type specifies the type of the property values.  
NextProperty This parameter allows property types to be nested, so that an arbitrary number of properties can be attached to the same graph. no_property

Where Defined


Associated Types

The NextProperty type parameter.
The Tag type parameter.
The T type parameter.

Member Functions

Construct a property object with member m_value a default constructed instance of type T and with the super object default constructed. Note that T must be Default Constructible for this property, and all the inherited property types.
property(const T& v)
Construct a property object with member m_value a copy of v.
property(const T& v, const NextProperty& b)
Construct a property object with member m_value a copy of v and whose super class NextProperty is constructed from b.

Property Tags

The following property tags are defined in boost/graph/properties.hpp.
  namespace boost {
    enum edge_name_t { edge_name }; 
    enum edge_weight_t { edge_weight }; 
    enum edge_index_t { edge_index };
    enum edge_capacity_t { edge_capacity }; 
    enum edge_residual_capacity_t { edge_residual_capacity }; 
    enum edge_reverse_t { edge_reverse }; 
    enum vertex_name_t { vertex_name }; 
    enum vertex_distance_t { vertex_distance }; 
    enum vertex_index_t { vertex_index };
    enum vertex_color_t { vertex_color }; 
    enum vertex_degree_t { vertex_degree }; 
    enum vertex_out_degree_t { vertex_out_degree }; 
    enum vertex_in_degree_t { vertex_in_degree }; 
    enum vertex_discover_time_t { vertex_discover_time }; 
    enum vertex_finish_time_t { vertex_finish_time }; 
    enum graph_name_t { graph_name };

    BOOST_INSTALL_PROPERTY(vertex, index);
    BOOST_INSTALL_PROPERTY(edge, index);
    // ...