
junkmail.hoefling@arcor.de wrote:
Hi there,
I have a problem using boost::variant. I want apply_visitor to go through a list of pairs whose first type is a variant. Using compose1 and select1st from the SGI extensions to the STL yields a constness error. The problem is illustrated by the attached code which shoud be compiled with the g++ (the SGI extensions are here available via __gnu_cxx).
What's wrong? Is it my fault using the library or is it a missing const version in apply_visitor_delayed_t()?
Judging by the comments in apply_visitor_delayed.hpp, it may be missing the const overloads on purpose... but I think that this is a mistake. FWIW, for_each( v.begin(), v.end(), bind( apply_visitor(_dummy), bind<TMixed&>( &TPair::first, _1 ) ) ); works (when using boost/bind.hpp), but it isn't particularly elegant.