/Src/Dependencies/Boost/boost/range/algorithm_ext/insert.hpp

http://hadesmem.googlecode.com/ · C++ Header · 42 lines · 28 code · 5 blank · 9 comment · 1 complexity · f26e54dfdb50b81c1c00ffd18e565393 MD5 · raw file

  1. // Boost.Range library
  2. //
  3. // Copyright Neil Groves 2009. Use, modification and
  4. // distribution is subject to the Boost Software License, Version
  5. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. // For more information, see http://www.boost.org/libs/range/
  9. //
  10. #ifndef BOOST_RANGE_ALGORITHM_EXT_INSERT_HPP_INCLUDED
  11. #define BOOST_RANGE_ALGORITHM_EXT_INSERT_HPP_INCLUDED
  12. #include <boost/range/config.hpp>
  13. #include <boost/range/concepts.hpp>
  14. #include <boost/range/difference_type.hpp>
  15. #include <boost/range/begin.hpp>
  16. #include <boost/range/end.hpp>
  17. #include <boost/assert.hpp>
  18. namespace boost
  19. {
  20. namespace range
  21. {
  22. template< class Container, class Range >
  23. inline Container& insert( Container& on,
  24. BOOST_DEDUCED_TYPENAME Container::iterator before,
  25. const Range& from )
  26. {
  27. BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
  28. BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<Range> ));
  29. BOOST_ASSERT( (void*)&on != (void*)&from &&
  30. "cannot copy from a container to itself" );
  31. on.insert( before, boost::begin(from), boost::end(from) );
  32. return on;
  33. }
  34. } // namespace range
  35. using range::insert;
  36. } // namespace boost
  37. #endif // include guard