3 #if !defined(CPPLINQ_LINQ_ITERATORS_HPP) 4 #define CPPLINQ_LINQ_ITERATORS_HPP 15 #define CPPLINQ_USE_DEFAULT_ITERATOR_OPERATORS \ 16 operator ::cpplinq::use_default_iterator_operators() const { return ::cpplinq::use_default_iterator_operators(); } 19 typename std::enable_if<
20 std::is_convertible<Iter, use_default_iterator_operators>::value,
23 operator+(
const Iter& it,
typename std::iterator_traits<Iter>::distance_type n) {
27 typename std::enable_if<
28 std::is_convertible<Iter, use_default_iterator_operators>::value,
31 operator-(
const Iter& it,
typename std::iterator_traits<Iter>::distance_type n) {
35 typename std::enable_if<
36 std::is_convertible<Iter, use_default_iterator_operators>::value,
39 operator-=(
const Iter& it,
typename std::iterator_traits<Iter>::distance_type n) {
44 typename std::enable_if<
45 std::is_convertible<Iter, use_default_iterator_operators>::value,
52 typename std::enable_if<
53 std::is_convertible<Iter, use_default_iterator_operators>::value,
60 typename std::enable_if<
61 std::is_convertible<Iter, use_default_iterator_operators>::value,
68 typename std::enable_if<
69 std::is_convertible<Iter, use_default_iterator_operators>::value,
77 template <
class Iter,
class T>
78 typename std::iterator_traits<Iter>::pointer
deref_iterator(
const Iter& it) {
82 template <
class Iter,
class T>
87 template <
class Iter,
class T>
105 explicit iter_range(Iter start, Iter finish) : start(start), finish(finish) {}
106 iterator
begin()
const {
return start; }
107 iterator
end()
const {
return finish; }
109 template <
class Iter>
115 template <
class Cursor>
117 :
public std::iterator<std::forward_iterator_tag,
118 typename Cursor::element_type,
120 typename std::conditional<std::is_reference<typename Cursor::reference_type>::value,
121 typename std::add_pointer<typename Cursor::element_type>::type,
122 util::value_ptr<typename Cursor::element_type>>::type,
123 typename Cursor::reference_type>
135 return !cur && !other.cur;
150 if (cur->empty()) { cur.reset(); }
157 if (cur->empty()) { cur.reset(); }
165 !cur || cur->empty();
171 template <
class Container>
185 return iterator(c.get_cursor());
cursor_iterator::pointer operator->() const
Definition: linq_iterators.hpp:142
Definition: linq_iterators.hpp:116
auto empty() -> decltype(from< T >())
Returns an observable that sends no items to observer and immediately completes, on the specified sch...
Definition: rx-empty.hpp:37
std::enable_if< std::is_convertible< Iter, use_default_iterator_operators >::value, bool >::type operator>=(const Iter &it, const Iter &it2)
Definition: linq_iterators.hpp:72
std::enable_if< std::is_convertible< Iter, use_default_iterator_operators >::value, Iter >::type operator-=(const Iter &it, typename std::iterator_traits< Iter >::distance_type n)
Definition: linq_iterators.hpp:39
iter_range< Iter > make_range(Iter start, Iter finish)
Definition: linq_iterators.hpp:110
iter_range(Iter start, Iter finish)
Definition: linq_iterators.hpp:105
CPPLINQ_USE_DEFAULT_ITERATOR_OPERATORS
Definition: linq_iterators.hpp:126
Definition: linq_iterators.hpp:172
cursor_iterator()
Definition: linq_iterators.hpp:131
cursor_iterator & operator+=(std::ptrdiff_t n)
Definition: linq_iterators.hpp:154
std::enable_if< std::is_convertible< Iter, use_default_iterator_operators >::value, Iter >::type operator-(const Iter &it, typename std::iterator_traits< Iter >::distance_type n)
Definition: linq_iterators.hpp:31
#define CPPLINQ_USE_DEFAULT_ITERATOR_OPERATORS
Definition: linq_iterators.hpp:15
std::enable_if< std::is_convertible< Iter, use_default_iterator_operators >::value, bool >::type operator>(const Iter &it, const Iter &it2)
Definition: linq_iterators.hpp:56
cursor_iterator & operator++()
Definition: linq_iterators.hpp:147
Definition: linq_iterators.hpp:95
std::enable_if< std::is_convertible< Iter, use_default_iterator_operators >::value, bool >::type operator<=(const Iter &it, const Iter &it2)
Definition: linq_iterators.hpp:64
cursor_iterator< typename Container::cursor > iterator
Definition: linq_iterators.hpp:177
bool operator==(const cursor_iterator &other) const
Definition: linq_iterators.hpp:134
std::enable_if< std::is_convertible< Iter, use_default_iterator_operators >::value, Iter >::type operator+(const Iter &it, typename std::iterator_traits< Iter >::distance_type n)
Definition: linq_iterators.hpp:23
Cursor::reference_type operator*() const
Definition: linq_iterators.hpp:138
Definition: linq_iterators.hpp:13
container_range(Container c)
Definition: linq_iterators.hpp:179
iterator end() const
Definition: linq_iterators.hpp:107
std::enable_if< std::is_convertible< Iter, use_default_iterator_operators >::value, bool >::type operator!=(const Iter &it, const Iter &it2)
Definition: linq_iterators.hpp:48
iterator begin() const
Definition: linq_iterators.hpp:106
cursor_iterator(Cursor cur)
Definition: linq_iterators.hpp:128
iterator end() const
Definition: linq_iterators.hpp:188
iterator::value_type value_type
Definition: linq_iterators.hpp:103
CPPLINQ_USE_DEFAULT_ITERATOR_OPERATORS typedef Iter iterator
Definition: linq_iterators.hpp:102
iterator begin() const
Definition: linq_iterators.hpp:183
util::value_ptr< T > deref_iterator(const Iter &it, util::identity< T >)
Definition: linq_iterators.hpp:88