
I was looking through the FOR_EACH - implementation, and noticed that it lacks rvalue detection for Visual C++ 6.0. After some investigation, I have found one very sleazy way of detecting rvalue-ness runtime without evaluating the argument more than once: # define BOOST_FOREACH_TYPEOF(COL) \ *(true ? 0 : &::boost::for_each::wrap(COL)) template<typename T> inline static_any<simple_variant<T const> > contain(int const& position_test,T const &t, bool const &, mpl::false_) { int rvalue_test=int(&t)-int(&position_test); bool rvalue=(rvalue_test<=8); return rvalue ? simple_variant<T const>(t) : simple_variant<T const>(&t); } Since this relies on the position of objects on the stack, there are probably cases where it will fail. Pointers (e.g. string constants) must be handled separately. Regards Peder