23template <typename T, std::enable_if_t<std::is_arithmetic<T>::value,
int> = 0>
27 template <
typename ItT>
41 using value_type = ItT;
42 using pointer = value_type*;
43 using reference = value_type
const&;
44 using iterator_category = std::input_iterator_tag;
65 return !(*
this == other);
87 : start_{start}, end_{
end}, step_{step}
90 throw std::invalid_argument(
"step size cannot be zero or negative");
107 template <
typename Q = T>
108 std::enable_if_t<std::is_floating_point<Q>::value, std::size_t>
size()
const
110 return static_cast<std::size_t
>(std::ceil((end_ - start_) / step_));
114 template <
typename Q = T>
115 std::enable_if_t<std::is_integral<Q>::value, std::size_t>
size()
const
117 return static_cast<std::size_t
>((end_ - start_) / step_);
130 for (
const auto& v : it) {
131 if (v != *it.
begin()) {
161template <
typename T0,
typename T1>
177template <
typename T0,
typename T1,
typename T2>
178auto range(T0 start, T1 stop, T2 step)
193template <typename T, std::enable_if_t<std::is_arithmetic<T>::value,
int> = 0>
197 template <
typename ItT>
217 using value_type = std::pair<ItT const&, ItT const&>;
218 using pointer = value_type*;
219 using reference = value_type;
220 using iterator_category = std::input_iterator_tag;
235 return u_ == other.
u_ and
v_ == other.
v_;
241 return !(*
this == other);
278 throw std::invalid_argument(
"step size cannot be zero or negative");
301 template <
typename Q = T>
302 std::enable_if_t<std::is_floating_point<Q>::value, std::size_t>
size()
const
311 template <
typename Q = T>
312 std::enable_if_t<std::is_integral<Q>::value, std::size_t>
size()
const
340template <
typename T0,
typename T1>
357template <
typename T0,
typename T1,
typename T2,
typename T3>
358auto range2D(T0 vStart, T1 vStop, T2 uStart, T3 uStop)
375template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4>
376auto range2D(T0 vStart, T1 vStop, T2 uStart, T3 uStop, T4 step)
382template <
class Iterable>
383class EnumerateIterable;
385template <
class Iterable>
388template <
typename... Args>
389inline EnumerateIterable<std::vector<std::common_type_t<Args...>>>
enumerate(
400template <
class Iterable>
416 std::pair<std::size_t, decltype(*std::declval<T&>())&>;
417 using pointer = value_type*;
418 using reference = value_type;
419 using iterator_category = std::input_iterator_tag;
424 : idx_{idx}, it_{std::move(it)}
434 return it_ == other.it_;
440 return !(*
this == other);
452 using IteratorType =
decltype(std::begin(std::declval<Iterable>()));
455 : container_{std::forward<Iterable>(container)}
459 template <
typename... Args>
460 EnumerateIterable(Args&&... args) : container_{std::forward<Args>(args)...}
464 friend auto enumerate<Iterable>(Iterable&& it);
466 template <
typename... Args>
467 friend EnumerateIterable<std::vector<std::common_type_t<Args...>>>
471 using iterator = EnumerateIterator<IteratorType>;
472 using const_iterator = EnumerateIterator<const IteratorType>;
526template <
class Iterable>
548template <
typename... Args>
552 using Type = std::common_type_t<Args...>;
553 using Iterable = std::vector<Type>;
EnumerateIterator & operator++()
bool operator==(const EnumerateIterator &other) const
EnumerateIterator(std::size_t idx, T &&it)
std::size_t difference_type
value_type operator*() const
bool operator!=(const EnumerateIterator &other) const
friend auto enumerate(Iterable &&it)
Wrap an Iterable into a new one whose iterators return an [index, value] pair.
const_iterator cbegin() const
const_iterator cend() const
bool operator!=(const Counting2DIterator &other) const
std::size_t difference_type
reference operator*() const
Counting2DIterator & operator++()
Counting2DIterator(ItT v, ItT vMax, ItT u, ItT uMax, ItT step)
bool operator==(const Counting2DIterator &other) const
Provides an iterable range of 2D number pairs with optional step size.
std::enable_if_t< std::is_integral< Q >::value, std::size_t > size() const
Range2DIterable(T vStart, T vEnd, T uStart, T uEnd, T step)
const_iterator cbegin() const
const_iterator cend() const
std::enable_if_t< std::is_floating_point< Q >::value, std::size_t > size() const
CountingIterator & operator++()
bool operator!=(const CountingIterator &other) const
std::size_t difference_type
CountingIterator(ItT value, ItT maxValue, ItT step)
reference operator*() const
bool operator==(const CountingIterator &other) const
Provides an iterable range of numbers with optional step size.
std::enable_if_t< std::is_floating_point< Q >::value, std::size_t > size() const
const_iterator cbegin() const
std::enable_if_t< std::is_integral< Q >::value, std::size_t > size() const
const_iterator cend() const
RangeIterable(T start, T end, T step)
auto enumerate(Iterable &&it)
Wrap an Iterable into a new one whose iterators return an [index, value] pair.
auto range2D(T0 vStop, T1 uStop)
Type
Implemented Volume Landmark types.
Volume Cartographer library
std::ostream & operator<<(std::ostream &os, const RangeIterable< T > &it)