next up previous contents index
Next: Node Member Accessors ( Up: Graphs and Iterators Previous: Node Array Data Accessor   Contents   Index


Constant Accessors ( constant_da )

Definition

An instance ca of class constant_da<T> is bound to a specific value of type T, and the function get(ca,it) simply returns this value for each iterator.

#include < LEDA/graph/graph_iterator.h >

Creation

constant_da<T> ca(T t) introduces a variable ca of this class bound to the given value t.

Operations

T get(const constant_da<T>& ca, const Iter& it)
    returns the value to which ca is bound.

Example

With the template function of sect. node_array_da we can write a function that counts the number of nodes in a graph:

  int count_all(graph G) {
    constant_da<color> Color(red);
    return count_red_t(G,Color); }



root 2008-01-09