diff --git a/include/boost/range/algorithm/fill_n.hpp b/include/boost/range/algorithm/fill_n.hpp index f827135..29d7d6f 100755 --- a/include/boost/range/algorithm/fill_n.hpp +++ b/include/boost/range/algorithm/fill_n.hpp @@ -26,6 +26,7 @@ namespace boost /// range-based version of the fill_n std algorithm /// /// \pre ForwardRange is a model of the ForwardRangeConcept +/// \pre n <= std::distance(boost::begin(rng), boost::end(rng)) template< class ForwardRange, class Size, class Value > inline ForwardRange& fill_n(ForwardRange& rng, Size n, const Value& val) { diff --git a/include/boost/range/algorithm_ext/erase.hpp b/include/boost/range/algorithm_ext/erase.hpp index 3b0e037..107d32b 100755 --- a/include/boost/range/algorithm_ext/erase.hpp +++ b/include/boost/range/algorithm_ext/erase.hpp @@ -24,29 +24,32 @@ namespace boost { template< class Container > -inline void erase( Container& on, +inline Container& erase( Container& on, iterator_range to_erase ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); on.erase( boost::begin(to_erase), boost::end(to_erase) ); + return on; } template< class Container, class T > -inline void remove_erase( Container& on, const T& val ) +inline Container& remove_erase( Container& on, const T& val ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); on.erase( std::remove(boost::begin(on), boost::end(on), val), boost::end(on)); + return on; } template< class Container, class Pred > -inline void remove_erase_if( Container& on, Pred pred ) +inline Container& remove_erase_if( Container& on, Pred pred ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); on.erase( std::remove_if(boost::begin(on), boost::end(on), pred), boost::end(on)); + return on; } } // namespace range diff --git a/include/boost/range/algorithm_ext/insert.hpp b/include/boost/range/algorithm_ext/insert.hpp index a887f15..b9adfdd 100755 --- a/include/boost/range/algorithm_ext/insert.hpp +++ b/include/boost/range/algorithm_ext/insert.hpp @@ -23,15 +23,16 @@ namespace boost { template< class Container, class Range > -inline void insert( Container& on, - BOOST_DEDUCED_TYPENAME Container::iterator before, - const Range& from ) +inline Container& insert( Container& on, + BOOST_DEDUCED_TYPENAME Container::iterator before, + const Range& from ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_ASSERT( (void*)&on != (void*)&from && "cannot copy from a container to itself" ); on.insert( before, boost::begin(from), boost::end(from) ); + return on; } } // namespace range diff --git a/include/boost/range/algorithm_ext/iota.hpp b/include/boost/range/algorithm_ext/iota.hpp index 4a03a59..65cbc89 100644 --- a/include/boost/range/algorithm_ext/iota.hpp +++ b/include/boost/range/algorithm_ext/iota.hpp @@ -22,7 +22,7 @@ namespace boost { template< class ForwardRange, class Value > -inline void iota( ForwardRange& rng, Value x ) +inline ForwardRange& iota( ForwardRange& rng, Value x ) { BOOST_CONCEPT_ASSERT(( ForwardRangeConcept )); typedef BOOST_DEDUCED_TYPENAME range_iterator::type iterator_t; @@ -30,6 +30,8 @@ inline void iota( ForwardRange& rng, Value x ) iterator_t last_target = ::boost::end(rng); for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x) *target = x; + + return rng; } } // namespace range diff --git a/include/boost/range/algorithm_ext/push_back.hpp b/include/boost/range/algorithm_ext/push_back.hpp index e52de41..51a7a7b 100755 --- a/include/boost/range/algorithm_ext/push_back.hpp +++ b/include/boost/range/algorithm_ext/push_back.hpp @@ -23,13 +23,14 @@ namespace boost { template< class Container, class Range > -inline void push_back( Container& on, const Range& from ) +inline Container& push_back( Container& on, const Range& from ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_ASSERT( (void*)&on != (void*)&from && "cannot copy from a container to itself" ); on.insert( on.end(), boost::begin(from), boost::end(from) ); + return on; } } // namespace range diff --git a/include/boost/range/algorithm_ext/push_front.hpp b/include/boost/range/algorithm_ext/push_front.hpp index 6ee269b..470d793 100755 --- a/include/boost/range/algorithm_ext/push_front.hpp +++ b/include/boost/range/algorithm_ext/push_front.hpp @@ -23,13 +23,14 @@ namespace boost { template< class Container, class Range > -inline void push_front( Container& on, const Range& from ) +inline Container& push_front( Container& on, const Range& from ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_ASSERT( (void*)&on != (void*)&from && "cannot copy from a container to itself" ); on.insert( on.begin(), boost::begin(from), boost::end(from) ); + return on; } } // namespace range