Boost C++ Libraries

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

C++ Boost

property_put<PropertyMap, EventTag>

This is an EventVisitor that can be used to write a fixed value to a property map when a vertex or edge is visited at some event-point within an algorithm. For example, this visitor can be used as an alternative to a loop to initialize a property map, or it can be used to mark only back edges with a property.

property_put can be used with graph algorithms by wrapping it with the algorithm-specific adaptor, such as bfs_visitor and dfs_visitor. Also, this event visitor can be combined with other event visitors using std::pair to form an EventVisitorList.

Example

  boost::depth_first_search
    (G, boost::visitor(
          boost::make_dfs_visitor(
            boost::put_property(is_back_edge, boost::on_back_edge()))));

Model of

EventVisitor

Where Defined

boost/graph/visitors.hpp

Template Parameters

ParameterDescriptionDefault
PropertyMap A WritablePropertyMap, where the key_type is the vertex descriptor type or edge descriptor of the graph (depending on the kind of event tag).  
EventTag The tag to specify when the property_put should be applied during the graph algorithm.  

Associated Types

TypeDescription
property_put::event_filter This will be the same type as the template parameter EventTag.

Member Functions

MemberDescription
property_put(PropertyMap pa, property_traits::value_type val); Construct a property put object with the property map pa and constant value val.
template <class X, class Graph>
void operator()(X x, const Graph& g);
This puts the value val into the property map for the vertex or edge x.

Non-Member Functions

FunctionDescription
template <class PropertyMap, class EventTag>
property_put<PropertyMap, EventTag>
put_property(PropertyMap pa, typename property_traits::value_type val, EventTag);
A convenient way to create a property_put.

See Also

Visitor concepts

The following are other event visitors: distance_recorder, predecessor_recorder, and time_stamper.


Copyright © 2000-2001 Jeremy Siek, Indiana University (jsiek@osl.iu.edu)
Lie-Quan Lee, Indiana University (llee@cs.indiana.edu)
Andrew Lumsdaine, Indiana University (lums@osl.iu.edu)
Copyright © 2010Matthias Walter (xammy@xammy.homelinux.net)
Trustees of Indiana University