All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
iterator_utils.hpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c) 2013 Piotr Wygocki
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //=======================================================================
15 #include "type_functions.hpp"
16 #include "functors.hpp"
17 
18 #include <boost/iterator/filter_iterator.hpp>
19 
20 #include <functional>
21 
22 #ifndef PAAL_ITERATOR_UTILS_HPP
23 #define PAAL_ITERATOR_UTILS_HPP
24 
25 namespace paal {
26 namespace utils {
27 
33 template <typename Iterator>
34 struct iterator_with_excluded_element : public boost::filter_iterator<
35  decltype(std::bind(
36  utils::not_equal_to(),
37  std::declval<typename std::iterator_traits<Iterator>::value_type>(),
38  std::placeholders::_1)),
39  Iterator> {
40 
41  typedef typename std::iterator_traits<Iterator>::value_type Element;
49  iterator_with_excluded_element(Iterator i, Iterator end, const Element &e)
50  : boost::filter_iterator<
51  decltype(std::bind(utils::not_equal_to(), std::declval<Element>(),
52  std::placeholders::_1)),
53  Iterator>(std::bind(utils::not_equal_to(), e,
54  std::placeholders::_1),
55  i, end) {}
56 
58 };
59 
60 } // utils
61 } // paal
62 
63 #endif // PAAL_ITERATOR_UTILS_HPP
this iterator exlcludes one specific element from range
not_equal_to functor
Definition: functors.hpp:593
This file contains set of simple useful functors or functor adapters.
iterator_with_excluded_element(Iterator i, Iterator end, const Element &e)
constructor