...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Home | Libraries | People | FAQ | More |
boost::visit_each — Allow limited exploration of class members.
template<typename Visitor, typename T> void visit_each(const Visitor& visitor, const T& t, int );
The visit_each mechanism allows a visitor to be applied to every subobject in a given object. It is used by the Signals library to discover signals::trackable objects within a function object, but other uses may surface if used universally (e.g., conservative garbage collection). To fit within the visit_each framework, a visit_each overload must be supplied for each object type.
Effects: visitor(t), and for every subobject x of t:
If x is a reference, visit_each(visitor, ref(x), 0)
Otherwise, visit_each(visitor, x, 0)
Library authors will be expected to add additional overloads that specialize the T argument for their classes, so that subobjects can be visited.
Calls to visit_each are required to be unqualified, to enable argument-dependent lookup.
Last revised: , at GMT | Copyright © 2001-2003 Douglas Gregor |