I'm not able to use the latest Boost release, so I've plagarised some little
bits that are useful, and in the process might have missed something, so
bear with me.

I have this bit of code...

#include <algorithm>
#include <boost/range.hpp>

template < class SinglePassRange, class UnaryFunction >
    UnaryFunction for_each( SinglePassRange & rng, UnaryFunction fun )
{
    return std::for_each( boost::begin( rng ), boost::end( rng ), fun );
}

struct A { };
void f( const A & );

std::vector< A > generateVec( );

int main( )
{
    for_each( generateVec( ), f );
}

which understandably fails to compile as I'm passing an lvalue as non-const
reference. I can fix this by adding a const ref overload of for_each, but no such
overload exists in the real boost range header (AFAIK).

Returning containers by value seems to be the 'right way' now, as RVO should
sort out the copy elision.

What I'm doing in this code seems reasonable - should it be supported by
const ref overloads, or have I missed some 'gotcha' somewhere?

Thanks,

- Rob.