Boost Users :
From: Erwin (junkmail.hoefling_at_[hidden])
Date: 2005-07-07 03:25:10
Thanks Peter Dimov!
When I posted the message, the scales fell from my eyes and I realized a
even simpler workaround: Simply perform the loop myself and use the
explicit version of apply_visitor:
Replace the for_each construction
for_each( v.begin(), v.end(),
compose1(apply_visitor(_dummy), select1st<TPair>() ) ); //
yields a const error
by the explicit loop
for( vector<TPair>::iterator it=v.begin(); it!=v.end(); ++it )
This is a little bit less general since we have to know the type of v in
advance, however, for me it works.
Anyway, I would consider the problem as a bug in boost::visitor. The
remark in apply_visitor_delayed.hpp about the dead reference doesn't make
sense to me. As long as apply_visitor is in action, a temporary visitor
object is alive, isn't it?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net