stlab.adobe.com Adobe Systems Incorporated

remove.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2005-2007 Adobe Systems Incorporated
00003     Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
00004     or a copy at http://stlab.adobe.com/licenses.html)
00005 */
00006 
00007 /*************************************************************************************************/
00008 
00009 #ifndef ADOBE_ALGORITHM_REMOVE_HPP
00010 #define ADOBE_ALGORITHM_REMOVE_HPP
00011 
00012 #include <adobe/config.hpp>
00013 
00014 #include <boost/range/begin.hpp>
00015 #include <boost/range/end.hpp>
00016 #include <boost/bind.hpp>
00017 
00018 #include <algorithm>
00019 
00020 /*************************************************************************************************/
00021 
00022 namespace adobe {
00023 
00024 /*************************************************************************************************/
00035 /*************************************************************************************************/
00041 template <class InputRange, class T>
00042 inline typename boost::range_iterator<InputRange>::type remove(InputRange& range, const T& value)
00043 {
00044     return std::remove(boost::begin(range), boost::end(range), value);
00045 }
00046 
00052 template <class InputIterator, class Predicate>
00053 inline InputIterator remove_if(InputIterator first, InputIterator last, Predicate pred)
00054 {
00055     return std::remove_if(first, last, boost::bind(pred, _1));
00056 }
00057 
00063 template <class InputRange, class Predicate>
00064 inline typename boost::range_iterator<InputRange>::type
00065 remove_if(InputRange& range, Predicate pred)
00066 {
00067     return adobe::remove_if(boost::begin(range), boost::end(range), pred);
00068 }
00069 
00075 template <class InputRange, class OutputIterator, class T>
00076 inline typename boost::range_iterator<InputRange>::type
00077 remove_copy(InputRange& range, OutputIterator result, const T& value)
00078 {
00079     return std::remove_copy(boost::begin(range), boost::end(range), result, value);
00080 }
00081 
00087 template <class InputRange, class OutputIterator, class T>
00088 inline typename boost::range_const_iterator<InputRange>::type
00089 remove_copy(const InputRange& range, OutputIterator result, const T& value)
00090 {
00091     return std::remove_copy(boost::begin(range), boost::end(range), result, value);
00092 }
00093 
00099 template <class InputIterator, class OutputIterator, class Predicate>
00100 inline InputIterator
00101 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred)
00102 {
00103     return std::remove_copy_if(first, last, result, boost::bind(pred, _1));
00104 }
00105 
00111 template <class InputRange, class OutputIterator, class Predicate>
00112 inline typename boost::range_iterator<InputRange>::type
00113 remove_copy_if(InputRange& range, OutputIterator result, Predicate pred)
00114 {
00115     return adobe::remove_copy_if(boost::begin(range), boost::end(range), result, pred);
00116 }
00117 
00123 template <class InputRange, class OutputIterator, class Predicate>
00124 inline typename boost::range_const_iterator<InputRange>::type
00125 remove_copy_if(const InputRange& range, OutputIterator result, Predicate pred)
00126 {
00127     return adobe::remove_copy_if(boost::begin(range), boost::end(range), result, pred);
00128 }
00129 
00130 /*************************************************************************************************/
00131 
00132 } // namespace adobe
00133 
00134 /*************************************************************************************************/
00135 
00136 #endif
00137 
00138 /*************************************************************************************************/

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