Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
remove.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6/**************************************************************************************************/
7
8#ifndef ADOBE_ALGORITHM_REMOVE_HPP
9#define ADOBE_ALGORITHM_REMOVE_HPP
10
11#include <adobe/config.hpp>
12
13#include <boost/range/begin.hpp>
14#include <boost/range/end.hpp>
15
16#include <algorithm>
17#include <functional>
18
19/**************************************************************************************************/
20
21namespace adobe {
22
23/**************************************************************************************************/
34/**************************************************************************************************/
40template <class InputRange, class T>
41inline typename boost::range_iterator<InputRange>::type remove(InputRange& range, const T& value) {
42 return std::remove(boost::begin(range), boost::end(range), value);
43}
44
50template <class InputIterator, class Predicate>
51inline InputIterator remove_if(InputIterator first, InputIterator last, Predicate pred) {
52 return std::remove_if(first, last, std::bind(pred, std::placeholders::_1));
53}
54
60template <class InputRange, class Predicate>
61inline typename boost::range_iterator<InputRange>::type remove_if(InputRange& range,
62 Predicate pred) {
63 return adobe::remove_if(boost::begin(range), boost::end(range), pred);
64}
65
71template <class InputRange, class OutputIterator, class T>
72inline typename boost::range_iterator<InputRange>::type
73remove_copy(InputRange& range, OutputIterator result, const T& value) {
74 return std::remove_copy(boost::begin(range), boost::end(range), result, value);
75}
76
82template <class InputRange, class OutputIterator, class T>
83inline typename boost::range_const_iterator<InputRange>::type
84remove_copy(const InputRange& range, OutputIterator result, const T& value) {
85 return std::remove_copy(boost::begin(range), boost::end(range), result, value);
86}
87
93template <class InputIterator, class OutputIterator, class Predicate>
94inline InputIterator remove_copy_if(InputIterator first, InputIterator last, OutputIterator result,
95 Predicate pred) {
96 return std::remove_copy_if(first, last, result, std::bind(pred, std::placeholders::_1));
97}
98
104template <class InputRange, class OutputIterator, class Predicate>
105inline typename boost::range_iterator<InputRange>::type
106remove_copy_if(InputRange& range, OutputIterator result, Predicate pred) {
107 return adobe::remove_copy_if(boost::begin(range), boost::end(range), result, pred);
108}
109
115template <class InputRange, class OutputIterator, class Predicate>
116inline typename boost::range_const_iterator<InputRange>::type
117remove_copy_if(const InputRange& range, OutputIterator result, Predicate pred) {
118 return adobe::remove_copy_if(boost::begin(range), boost::end(range), result, pred);
119}
120
121/**************************************************************************************************/
122
123} // namespace adobe
124
125/**************************************************************************************************/
126
127#endif
128
129/**************************************************************************************************/
boost::range_iterator< InputRange >::type remove_copy(InputRange &range, OutputIterator result, const T &value)
remove implementation
Definition remove.hpp:73
InputIterator remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred)
remove implementation
Definition remove.hpp:94
InputIterator remove_if(InputIterator first, InputIterator last, Predicate pred)
remove implementation
Definition remove.hpp:51
boost::range_iterator< InputRange >::type remove(InputRange &range, const T &value)
remove implementation
Definition remove.hpp:41