stlab.adobe.com Adobe Systems Incorporated
remove.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2005-2007 Adobe Systems Incorporated
3  Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
4  or a copy at http://stlab.adobe.com/licenses.html)
5 */
6 
7 /*************************************************************************************************/
8 
9 #ifndef ADOBE_ALGORITHM_REMOVE_HPP
10 #define ADOBE_ALGORITHM_REMOVE_HPP
11 
12 #include <adobe/config.hpp>
13 
14 #include <boost/range/begin.hpp>
15 #include <boost/range/end.hpp>
16 #include <boost/bind.hpp>
17 
18 #include <algorithm>
19 
20 /*************************************************************************************************/
21 
22 namespace adobe {
23 
24 /*************************************************************************************************/
35 /*************************************************************************************************/
41 template <class InputRange, class T>
42 inline typename boost::range_iterator<InputRange>::type remove(InputRange& range, const T& value)
43 {
44  return std::remove(boost::begin(range), boost::end(range), value);
45 }
46 
52 template <class InputIterator, class Predicate>
53 inline InputIterator remove_if(InputIterator first, InputIterator last, Predicate pred)
54 {
55  return std::remove_if(first, last, boost::bind(pred, _1));
56 }
57 
63 template <class InputRange, class Predicate>
64 inline typename boost::range_iterator<InputRange>::type
65 remove_if(InputRange& range, Predicate pred)
66 {
67  return adobe::remove_if(boost::begin(range), boost::end(range), pred);
68 }
69 
75 template <class InputRange, class OutputIterator, class T>
76 inline typename boost::range_iterator<InputRange>::type
77 remove_copy(InputRange& range, OutputIterator result, const T& value)
78 {
79  return std::remove_copy(boost::begin(range), boost::end(range), result, value);
80 }
81 
87 template <class InputRange, class OutputIterator, class T>
88 inline typename boost::range_const_iterator<InputRange>::type
89 remove_copy(const InputRange& range, OutputIterator result, const T& value)
90 {
91  return std::remove_copy(boost::begin(range), boost::end(range), result, value);
92 }
93 
99 template <class InputIterator, class OutputIterator, class Predicate>
100 inline InputIterator
101 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred)
102 {
103  return std::remove_copy_if(first, last, result, boost::bind(pred, _1));
104 }
105 
111 template <class InputRange, class OutputIterator, class Predicate>
112 inline typename boost::range_iterator<InputRange>::type
113 remove_copy_if(InputRange& range, OutputIterator result, Predicate pred)
114 {
115  return adobe::remove_copy_if(boost::begin(range), boost::end(range), result, pred);
116 }
117 
123 template <class InputRange, class OutputIterator, class Predicate>
124 inline typename boost::range_const_iterator<InputRange>::type
125 remove_copy_if(const InputRange& range, OutputIterator result, Predicate pred)
126 {
127  return adobe::remove_copy_if(boost::begin(range), boost::end(range), result, pred);
128 }
129 
130 /*************************************************************************************************/
131 
132 } // namespace adobe
133 
134 /*************************************************************************************************/
135 
136 #endif
137 
138 /*************************************************************************************************/

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google