Returning a Boost.Range from a function

Boost.Range provides some little gems like boost::adaptors::filtered and boost::adaptors::transformed, which can be used to write sophisticated range-based for loops. However, in same cases we would like to factor the code that creates that range out of the function in which the iteration takes place; something…