[bug] Output the range to an ostream

Hi boosters! E.g. followed code can't be compiled std::wstring ws(L"test"); boost::iterator_range<std::wstring::const_iterator> wrange(ws); std::wcout << wrange; // compilation error here It seems the implementation of operator << for iterator_range is not correct: File boost/iterator/iterator_range.hpp #ifndef BOOST_OLD_IOSTREAMS template< typename IteratorT, typename Elem, typename Traits > inline std::basic_ostream<Elem,Traits>& operator<<( std::basic_ostream<Elem, Traits>& Os, const iterator_range<IteratorT>& r ) { std::copy( r.begin(), r.end(), std::ostream_iterator<Elem>(Os)); return Os; } .. I guess the function body should be like this: { typedef typename iterator_value<IteratorT>::type ValueType; std::copy( r.begin(), r.end(), std::ostream_iterator<ValueType, Elem, Traits>(Os)); return Os; } Regards, Alexander Potocki
participants (1)
-
Alexander Potocki