Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2006-01-24 15:49:48

On 01/20/2006 10:00 AM, David Abrahams wrote:
> I hope you're reusing the visitor mechanism provided by the signals
> library for function detection:
 From looking at:

     template<typename V>
   void visit_each(V& v, const tracking_bridge& t, int)

in $BOOST_ROOT/libs/signals/test/random_signal_system.cpp, I realized
the meaning of:

   a visit_each overload must be supplied for each object type.

in, i.e. the user must
explicitly call v(x) for each subobject, x, of T.

However, the phrase, 'for each subobject' in visit_each.html
is not really accurate since there is the subobject:

     minstd_rand& tracked_bridge::rand_gen;

in tracking_bridge.

Maybe "subobjects selected by user in the user's specialization of
visit_each" would be more accurate. Anyway, the essential difference
is that with visit_each, the user has to know which subobjects to
visit and has to explicitly code the visit. OTOH, with fields_visitor,
the user can select the object by "declaring" it visitable by wrapping
it in something derived from registrar_heirarchy. The visit_each
method is less intrusive (no need to modify the class to be visited),
but more work.

The following code:

demonstrates how fields_visitor can be used to emulate a visit_each
method. The other example program, simple_*.cpp, shows how to do it just
using fields_visitor.

FYI, the preliminary fields_visitor users_guide in the vault has been

-best regards & thanks for the interest,

Boost list run by bdawes at, gregod at, cpdaniel at, john at