1#ifndef HALCHECK_LIB_ITERATOR_TRANSFORM_HPP
2#define HALCHECK_LIB_ITERATOR_TRANSFORM_HPP
6#include <halcheck/lib/functional.hpp>
7#include <halcheck/lib/iterator/base.hpp>
8#include <halcheck/lib/iterator/interface.hpp>
9#include <halcheck/lib/iterator/range.hpp>
10#include <halcheck/lib/iterator/type_traits.hpp>
11#include <halcheck/lib/optional.hpp>
12#include <halcheck/lib/pp.hpp>
13#include <halcheck/lib/type_traits.hpp>
19namespace halcheck {
namespace lib {
27template<
typename I,
typename F>
35 template<
typename,
typename>
96 : _base(
std::move(other._base)), _func(
std::move(*other._func)) {}
114 : _base(
std::move(other._base)), _func(*
std::move(other._func)) {}
120 constexpr const I &
base() const & noexcept {
return _base; }
126 I
base() && {
return std::move(_base); }
150 template<bool _ = true, HALCHECK_REQUIRE(lib::is_bidirectional_iterator<I>() && _)>
161 template<bool _ = true, HALCHECK_REQUIRE(lib::is_random_access_iterator<I>() && _)>
174 return lhs._base == rhs._base;
182 template<bool _ = true, HALCHECK_REQUIRE(lib::is_random_access_iterator<I>() && _)>
184 return lhs._base - rhs._base;
224template<
typename V,
typename F>
232 template<
typename,
typename>
236 explicit ref(
const F *base =
nullptr) : base(base) {}
237 template<
typename... Args>
271 : _base(
std::move(other._base)), _func(
std::move(*other._func)) {}
289 : _base(
std::move(other._base)), _func(*
std::move(other._func)) {}
296 template<bool _ = true, HALCHECK_REQUIRE(std::is_copy_constructible<V>() && _)>
305 V
base() && {
return std::move(_base); }
351 template<typename U = V, HALCHECK_REQUIRE(lib::is_sized_range<U>())>
360 template<typename U = V, HALCHECK_REQUIRE(lib::is_sized_range<const U>())>
A utility class for easily defining new iterators.
Definition interface.hpp:40
An implementation of std::optional.
Definition optional.hpp:338
An implementation of std::ranges::view_interface.
Definition interface.hpp:238
HALCHECK_INLINE_CONSTEXPR struct halcheck::lib::@20 invoke
An implementation of std::invoke.
decltype(lib::invoke(std::declval< F >(), std::declval< Args >()...)) invoke_result_t
An implementation of std::invoke_result_t.
Definition invoke.hpp:42
HALCHECK_INLINE_CONSTEXPR struct halcheck::lib::@30 make_transform_iterator
Constructs a transform_iterator.
typename std::iterator_traits< I >::difference_type iter_difference_t
The return type of operator- for an iterator.
Definition base.hpp:32
typename std::iterator_traits< I >::reference iter_reference_t
The return type of operator* for an iterator.
Definition base.hpp:24
HALCHECK_INLINE_CONSTEXPR struct halcheck::lib::@25 size
Obtains the size of a range.
HALCHECK_INLINE_CONSTEXPR struct halcheck::lib::@31 transform
Constructs a transform_view.
typename std::iterator_traits< I >::iterator_category iter_category_t
A tag type indicating the level of supported iterator options a type provides.
Definition base.hpp:40
lib::iter_reference_t< lib::iterator_t< R > > range_reference_t
The type returned by operator* for a range type's iterators.
Definition range.hpp:340
lib::iter_difference_t< lib::iterator_t< R > > range_difference_t
The type of value returned by operator- for a range type's iterators.
Definition range.hpp:324
#define HALCHECK_INLINE_CONSTEXPR
A backwards-compatible substitute for inline constexpr.
Definition pp.hpp:70
typename std::remove_cv< typename std::remove_reference< T >::type >::type remove_cvref_t
An implementation of std::remove_cvref_t.
Definition type_traits.hpp:141
typename std::conditional< Cond, T, F >::type conditional_t
An implementation of std::conditional_t.
Definition type_traits.hpp:51
#define HALCHECK_REQUIRE(...)
Expands to a template argument that is only valid if the given argument evaluates to true.
Definition type_traits.hpp:24
An implementation of std::is_invocable.
Definition invoke.hpp:66
An implementation of std::is_nothrow_invocable.
Definition invoke.hpp:78
Determines whether the given type is a range.
Definition range.hpp:158