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_PUSH_BACK_HPP_INCLUDED |
11 | #define BOOST_RANGE_ALGORITHM_EXT_PUSH_BACK_HPP_INCLUDED |
12 | |
13 | #include <boost/range/config.hpp> |
14 | #include <boost/range/concepts.hpp> |
15 | #include <boost/range/difference_type.hpp> |
16 | #include <boost/range/begin.hpp> |
17 | #include <boost/range/end.hpp> |
18 | #include <boost/range/detail/implementation_help.hpp> |
19 | #include <boost/assert.hpp> |
20 | |
21 | namespace boost |
22 | { |
23 | namespace range |
24 | { |
25 | |
26 | template< class Container, class Range > |
27 | inline Container& push_back( Container& on, const Range& from ) |
28 | { |
29 | BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<Container> )); |
30 | BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const Range> )); |
31 | BOOST_ASSERT_MSG(!range_detail::is_same_object(on, from), |
32 | "cannot copy from a container to itself"); |
33 | on.insert( on.end(), boost::begin(from), boost::end(from) ); |
34 | return on; |
35 | } |
36 | |
37 | } // namespace range |
38 | using range::push_back; |
39 | } // namespace boost |
40 | |
41 | #endif // include guard |
42 |