source: vendor/nemo/current/NEMOGCM/EXTERNAL/XIOS/extern/boost/include/boost/range/algorithm/unique.hpp @ 44

Last change on this file since 44 was 44, checked in by cholod, 12 years ago

Load NEMO_TMP into vendor/nemo/current.

File size: 3.7 KB
Line 
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_UNIQUE_HPP_INCLUDED
10#define BOOST_RANGE_ALGORITHM_UNIQUE_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
19namespace boost
20{
21    namespace range
22    {
23
24/// \brief template function unique
25///
26/// range-based version of the unique std algorithm
27///
28/// \pre Rng meets the requirements for a Forward range
29template< range_return_value re, class ForwardRange >
30inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
31unique( ForwardRange& rng )
32{
33    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
34    return range_return<ForwardRange,re>::
35        pack( std::unique( boost::begin(rng),
36                           boost::end(rng)), rng );
37}
38
39/// \overload
40template< range_return_value re, class ForwardRange >
41inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
42unique( const ForwardRange& rng )
43{
44    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
45    return range_return<const ForwardRange,re>::
46        pack( std::unique( boost::begin(rng),
47                           boost::end(rng)), rng );
48}
49/// \overload
50template< range_return_value re, class ForwardRange, class BinaryPredicate >
51inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
52unique( ForwardRange& rng, BinaryPredicate pred )
53{
54    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
55    return range_return<ForwardRange,re>::
56        pack(std::unique(boost::begin(rng), boost::end(rng), pred),
57             rng);
58}
59/// \overload
60template< range_return_value re, class ForwardRange, class BinaryPredicate >
61inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
62unique( const ForwardRange& rng, BinaryPredicate pred )
63{
64    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
65    return range_return<const ForwardRange,re>::
66        pack(std::unique(boost::begin(rng), boost::end(rng), pred),
67             rng);
68}
69
70/// \overload
71template< class ForwardRange >
72inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange, return_begin_found>::type
73unique( ForwardRange& rng )
74{
75    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
76    return ::boost::range::unique<return_begin_found>(rng);
77}
78/// \overload
79template< class ForwardRange >
80inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange, return_begin_found>::type
81unique( const ForwardRange& rng )
82{
83    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
84    return ::boost::range::unique<return_begin_found>(rng);
85}
86/// \overload
87template< class ForwardRange, class BinaryPredicate >
88inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange, return_begin_found>::type
89unique( ForwardRange& rng, BinaryPredicate pred )
90{
91    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
92    return ::boost::range::unique<return_begin_found>(rng);
93}
94/// \overload
95template< class ForwardRange, class BinaryPredicate >
96inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
97unique( const ForwardRange& rng, BinaryPredicate pred )
98{
99    BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
100    return ::boost::range::unique<return_begin_found>(rng, pred);
101}
102
103    } // namespace range
104    using range::unique;
105} // namespace boost
106
107#endif // include guard
Note: See TracBrowser for help on using the repository browser.