
This handy little item, lvalue_cast, would make a useful addition to boost. I didn't write it, and I don't recall who did. template<class T> inline T& lvalue_cast (const T& rvalue) { return const_cast<T&> (rvalue); } Example usage: #include <vector> #include <boost/range.hpp> template<class T> inline T& lvalue_cast (const T& rvalue) { return const_cast<T&> (rvalue); } template<typename in_cont_t> int F (in_cont_t & in) { return 2; } int main() { std::vector<int> v (4); F (lvalue_cast (boost::make_iterator_range (v.begin(), v.end()))); << OK F (boost::make_iterator_range (v.begin(), v.end())); << error! } -- Please AVOID sending me WORD, EXCEL or POWERPOINT attachments. See http://www.fsf.org/philosophy/no-word-attachments.html