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.
Creation
| constant_da<T> | ca(T t); | introduces a variable ca of this class bound to the given value t. |
|
Operations
| T | get(constant_da<T> ca, 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); }