2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2019-01-07 08:47:17 +00:00
|
|
|
Copyright (c) 2011-2019 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
=============================================================================*/
|
2013-01-19 23:53:20 +00:00
|
|
|
#ifndef SPROUT_ITERATOR_REMOVE_ITERATOR_HPP
|
|
|
|
#define SPROUT_ITERATOR_REMOVE_ITERATOR_HPP
|
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
|
|
|
#include <sprout/iterator/filter_iterator.hpp>
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
//
|
|
|
|
// remove_filter
|
|
|
|
//
|
|
|
|
template<typename T>
|
|
|
|
class remove_filter {
|
|
|
|
public:
|
|
|
|
typedef bool result_type;
|
|
|
|
private:
|
|
|
|
T value_;
|
|
|
|
public:
|
2013-01-26 14:51:43 +00:00
|
|
|
explicit SPROUT_CONSTEXPR remove_filter(T const& value)
|
2013-01-19 23:53:20 +00:00
|
|
|
: value_(value)
|
|
|
|
{}
|
|
|
|
template<typename U>
|
|
|
|
SPROUT_CONSTEXPR bool operator()(U const& value) const {
|
|
|
|
return value != value_;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// make_remove_iterator
|
|
|
|
//
|
|
|
|
template<typename T, typename Iterator>
|
|
|
|
inline SPROUT_CONSTEXPR sprout::filter_iterator<sprout::remove_filter<T>, Iterator>
|
|
|
|
make_remove_iterator(T const& value, Iterator it, Iterator last = Iterator()) {
|
|
|
|
return sprout::filter_iterator<sprout::remove_filter<T>, Iterator>(
|
|
|
|
sprout::remove_filter<T>(value), it, last
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // SPROUT_ITERATOR_REMOVE_ITERATOR_HPP
|