Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/range/algorithm/partition.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 // Copyright Neil Groves 2009. Use, modification and | |
2 // distribution is subject to the Boost Software License, Version | |
3 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
4 // http://www.boost.org/LICENSE_1_0.txt) | |
5 // | |
6 // | |
7 // For more information, see http://www.boost.org/libs/range/ | |
8 // | |
9 #ifndef BOOST_RANGE_ALGORITHM_PARTITION__HPP_INCLUDED | |
10 #define BOOST_RANGE_ALGORITHM_PARTITION__HPP_INCLUDED | |
11 | |
12 #include <boost/concept_check.hpp> | |
13 #include <boost/range/begin.hpp> | |
14 #include <boost/range/end.hpp> | |
15 #include <boost/range/concepts.hpp> | |
16 #include <boost/range/detail/range_return.hpp> | |
17 #include <algorithm> | |
18 | |
19 namespace boost | |
20 { | |
21 namespace range | |
22 { | |
23 | |
24 /// \brief template function partition | |
25 /// | |
26 /// range-based version of the partition std algorithm | |
27 /// | |
28 /// \pre ForwardRange is a model of the ForwardRangeConcept | |
29 template<class ForwardRange, class UnaryPredicate> | |
30 inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type | |
31 partition(ForwardRange& rng, UnaryPredicate pred) | |
32 { | |
33 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> )); | |
34 return std::partition(boost::begin(rng),boost::end(rng),pred); | |
35 } | |
36 | |
37 /// \overload | |
38 template<class ForwardRange, class UnaryPredicate> | |
39 inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type | |
40 partition(const ForwardRange& rng, UnaryPredicate pred) | |
41 { | |
42 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> )); | |
43 return std::partition(boost::begin(rng),boost::end(rng),pred); | |
44 } | |
45 | |
46 // range_return overloads | |
47 | |
48 /// \overload | |
49 template< range_return_value re, class ForwardRange, | |
50 class UnaryPredicate > | |
51 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type | |
52 partition(ForwardRange& rng, UnaryPredicate pred) | |
53 { | |
54 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> )); | |
55 return boost::range_return<ForwardRange,re>:: | |
56 pack(std::partition(boost::begin(rng), boost::end(rng), pred), rng); | |
57 } | |
58 | |
59 /// \overload | |
60 template< range_return_value re, class ForwardRange, | |
61 class UnaryPredicate > | |
62 inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type | |
63 partition(const ForwardRange& rng, UnaryPredicate pred) | |
64 { | |
65 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> )); | |
66 return boost::range_return<const ForwardRange,re>:: | |
67 pack(std::partition(boost::begin(rng), boost::end(rng), pred), rng); | |
68 } | |
69 | |
70 } // namespace range | |
71 using range::partition; | |
72 } // namespace boost | |
73 | |
74 #endif // include guard |