#include <boost/visit_each.hpp>
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 trackable objects within a function
object, but other uses may surface if it 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.
namespace boost { template<typename Visitor, typename T> void visit_each(Visitor&, const T&, int); }
template<typename Visitor, typename T>
void visit_each(Visitor& v, const T& t, int);
v(t)
, and for every subobject
x
of t
,
x
is a reference, executes
v(boost::ref(x))
.x
is not a reference, executes
v(x)
.long
for the
fallback version of visit_each
defined in
<boost/visit_each.hpp>
, and the argument supplied to this third paramter must always be 0. The third parameter is an artifact of the widespread lack of proper function template ordering, and will be removed in the future.
Library authors will be expected to add additional overloads
that specialize the T
argument for their classes,
so that subobjects can be visited.