17 #ifndef OPENKALMAN_COLLECTIONS_VIEWS_IOTA_HPP 18 #define OPENKALMAN_COLLECTIONS_VIEWS_IOTA_HPP 20 #include <type_traits> 21 #ifdef __cpp_lib_ranges 38 template<
typename Start = std::
integral_constant<std::
size_t, 0>>
43 explicit constexpr
iota_generator(Start start) : start_ {std::move(start)} {};
46 template<values::index I>
48 template<
typename I, std::enable_if_t<values::index<I>,
int> = 0>
51 operator() (I i)
const 74 template<values::
integral Start = std::
integral_constant<std::
size_t, 0>, values::size Size = std::unreachable_sentinel_t>
76 std::same_as<Start, std::remove_reference_t<Start>> and
77 std::same_as<Size, std::remove_reference_t<Size>>
79 template<
typename Start = std::
integral_constant<std::
size_t, 0>,
typename Size = unreachable_sentinel_t>
85 using Size_ = std::conditional_t<values::index<Size>, Size, std::monostate>;
95 iota_view(Start start, Size_
size) requires values::index<Size>
97 template<
bool Enable = true, std::enable_if_t<Enable and values::index<Size>,
int> = 0>
106 #ifdef __cpp_concepts 108 iota_view(Size_ size) requires values::fixed<Start> and values::index<Size>
110 template<
bool Enable = true, std::enable_if_t<Enable and values::fixed<Start> and values::index<Size>,
int> = 0>
128 template<
typename Start,
typename Size>
134 template<
typename Size>
140 #ifdef __cpp_lib_ranges 141 namespace std::ranges
143 namespace OpenKalman::ranges
146 template<
typename Start,
typename Size>
147 constexpr
bool enable_borrowed_range<OpenKalman::collections::iota_view<Start, Size>> =
true;
153 #ifdef __cpp_concepts 154 template<
typename Start, OpenKalman::values::fixed Size>
156 : std::integral_constant<size_t, OpenKalman::values::fixed_number_of_v<Size>> {};
158 template<
typename Start,
typename Size>
160 : tuple_size<OpenKalman::collections::generate_view<OpenKalman::collections::detail::iota_generator<Start>, Size>> {};
164 #ifdef __cpp_concepts 165 template<std::
size_t i, OpenKalman::values::fixed Start,
typename Size>
172 template<std::
size_t i,
typename Start,
typename Size>
174 : tuple_element<i, OpenKalman::collections::generate_view<OpenKalman::collections::detail::iota_generator<Start>, Size>> {};
189 #ifdef __cpp_concepts 190 template<values::index Start, values::index Size> requires
193 template<
typename Start,
typename Size, std::enable_if_t<values::index<Start> and values::index<Size> and
194 std::is_convertible_v<values::number_type_of_t<Size>, values::number_type_of_t<Start>>,
int> = 0>
197 operator() (Start start, Size size)
const 206 #ifdef __cpp_concepts 207 template<values::index Size>
209 template<
typename Size, std::enable_if_t<values::index<Size>,
int> = 0>
212 operator() (Size size)
const 242 #endif //OPENKALMAN_COLLECTIONS_VIEWS_IOTA_HPP Definition for values::index.
constexpr detail::iota_adapter iota
a RangeAdapterObject associated with iota_view.
Definition: iota.hpp:237
Namespace for collections.
Definition: collections.hpp:27
Definition for values::fixed_number_of.
Definition for values::size.
An operation involving some number of values.
Definition: operation.hpp:69
Definition: tuple_reverse.hpp:103
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
An iota collection that is a std::range and may also be tuple_like.
Definition: iota.hpp:81
Definition for collections::generate_view and collections::views::generate.
Definition for value:number_type_of_t.
A collection_view created by lazily generating elements based on an index.
Definition: generate.hpp:44
constexpr iota_view(Start start, Size_ size)
Construct from an initial value and size.
Definition: iota.hpp:98
constexpr bool size
T is either an index representing a size, or void which represents that there is no size...
Definition: size.hpp:32
Namespace for generalized views.
Definition: collections.hpp:33
iota_view(const Start &, const Size &) -> iota_view< Start, Size >
Deduction guide.
constexpr iota_view(Size_ size)
Construct from a size, default-initializing Start.
Definition: iota.hpp:111
Definitions implementing features of the c++ ranges library for compatibility.
std::decay_t< decltype(values::to_number(std::declval< T >()))> number_type_of_t
Obtain the values::number type associated with avalues::value.
Definition: number_type_of_t.hpp:34