added algorithm_ext insert algorithm for containers without a where iterator.

This commit is contained in:
Neil Groves
2014-03-08 21:42:42 +00:00
parent 7cd8b9ec24
commit 343e74b8e3
2 changed files with 17 additions and 3 deletions

View File

@ -29,12 +29,18 @@ inline Container& insert( Container& on,
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<Range> ));
BOOST_ASSERT( (void*)&on != (void*)&from &&
"cannot copy from a container to itself" );
on.insert( before, boost::begin(from), boost::end(from) );
return on;
}
template< class Container, class Range >
inline Container& insert( Container& on, const Range& from )
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<Range> ));
on.insert(boost::begin(from), boost::end(from));
}
} // namespace range
using range::insert;
} // namespace boost