5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MDSPAN_IS_LAYOUT_MAPPING_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MDSPAN_IS_LAYOUT_MAPPING_HPP_
12#include "arene/base/stdlib_choice/declval.hpp"
13#include "arene/base/stdlib_choice/enable_if.hpp"
14#include "arene/base/stdlib_choice/integer_sequence.hpp"
15#include "arene/base/stdlib_choice/is_move_assignable.hpp"
16#include "arene/base/stdlib_choice/is_move_constructible.hpp"
17#include "arene/base/stdlib_choice/is_same.hpp"
27namespace is_layout_mapping_detail {
38extern constexpr bool is_invocable_with_extents_indices_v =
false;
47template <
typename T,
typename IndexType, IndexType... Indices>
48extern constexpr bool is_invocable_with_extents_indices_v<
50 std::integer_sequence<IndexType, Indices...>,
52 std::is_same<
invoke_result_t<T
const&,
decltype(Indices)...>, IndexType>::value;
79template <
typename T,
typename = constra
ints<>>
80extern constexpr bool is_basic_layout_mapping_v =
false;
108extern constexpr bool is_basic_layout_mapping_v<
111 typename T::extents_type,
112 typename T::index_type,
113 typename T::rank_type,
114 typename T::layout_type,
120 decltype(T::is_always_unique()),
121 decltype(T::is_always_strided()),
122 decltype(T::is_always_exhaustive()),
139 std::is_same<
decltype(T::is_always_unique()),
bool>::value &&
140 std::is_same<
decltype(T::is_always_exhaustive()),
bool>::value &&
141 std::is_same<
decltype(T::is_always_strided()),
bool>::value && is_invocable_with_extents_indices_v<T>;
145template <
template <
typename>
class T>
146struct mapping_template_check {};
151using uses_mapping = mapping_template_check<T::template mapping>;
161template <
typename T,
typename E,
typename = constra
ints<>>
162extern constexpr bool is_layout_mapping_policy_for_extents_v =
false;
167template <
typename T,
typename E>
168extern constexpr bool is_layout_mapping_policy_for_extents_v<
175 std::enable_if_t<std::is_same<typename T::template mapping<E>::extents_type, E>::value>,
176 std::enable_if_t<std::is_same<typename T::template mapping<E>::layout_type, T>::value>>> =
true;
204template <
typename T,
typename = constra
ints<>>
205extern constexpr bool is_layout_mapping_v =
false;
234extern constexpr bool is_layout_mapping_v<
239 std::is_same<typename T::layout_type::template mapping<typename T::extents_type>, T>::value>>> =
240 is_layout_mapping_policy_for_extents_v<typename T::layout_type, typename T::extents_type>;
271template <
typename T,
typename Enable =
void>
272extern constexpr bool is_layout_mapping_v = is_layout_mapping_detail::is_layout_mapping_v<T>;
291template <
typename T,
typename E>
293 is_layout_mapping_detail::is_layout_mapping_policy_for_extents_v<T, E>;
static constexpr value_type value
Definition integral_constant.hpp:34
Definition accumulate.hpp:37
constexpr bool is_nothrow_swappable_v
Trait query indicating if a type can be noexcept-swapped.
constexpr bool is_invocable_v
Determine if a functor type is invocable with the specified argument types.
constexpr bool substitution_succeeds
Determines if a template can be instantiated successfully, similar to C++20's requires clause.
typename invoke_result< Fn, Args... >::type invoke_result_t
The return type of a functor invoked with the specified arguments.
Definition is_invocable.hpp:271
constexpr bool is_copyable_v
Backport for the C++20 copyable concept.
constexpr bool is_layout_mapping_v
Helper trait to indicate if the given type has all the basic properties required of a layout mapping:
constexpr bool is_layout_mapping_policy_v
Helper trait to check if T is a valid layout mapping policy.
constexpr bool is_layout_mapping_policy_for_extents_v
Helper trait to check if T is a valid layout mapping policy for the extents E.
constexpr bool is_extents_v
Helper variable to check if a provided type is an instantiation of extents.
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
constexpr bool is_equality_comparable_v
Definition accumulate.hpp:36
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41
auto declval() noexcept -> T &&
A dummy function that is declared but not defined, with a user-specified return type,...
typename integer_sequence_detail::make_integer_sequence< Type, Size >::type make_integer_sequence
Helper alias template to simplify creation of std::integer_sequence types with 0, 1,...
Definition integer_sequence.hpp:212