13 template<std::
size_t I,
typename T,
bool = std::is_empty_v<T> && !std::is_final_v<T>>
29 template<std::
size_t I,
typename T>
32 static_assert(!std::is_reference_v<T>,
"llama::Tuple cannot store references to stateless types");
46 template<
typename... Elements>
53 template<
typename TFirstElement,
typename... RestElements>
56 ,
Tuple<RestElements...>
69 :
Leaf{std::move(first)}
80 sizeof...(RestElements) ==
sizeof...(Ts)
81 && std::is_constructible_v<FirstElement, T> && (std::is_constructible_v<RestElements, Ts> && ...),
86 ,
RestTuple(std::forward<Ts>(restArgs)...)
111 return static_cast<const RestTuple&
>(*this);
116 template<
typename... Elements>
120 template<std::size_t I,
typename... Elements>
123 using Base [[maybe_unused]]
125 return tuple.Base::value();
129 template<std::size_t I,
typename... Elements>
132 using Base [[maybe_unused]]
134 return tuple.Base::value();
139 template<
typename... Elements>
142 static constexpr
auto value =
sizeof...(Elements);
146 template<std::size_t I,
typename... Elements>
156 template<
typename... Elements, std::size_t... Is>
160 std::index_sequence<Is...>) ->
bool
162 return ((get<Is>(a) == get<Is>(b)) && ...);
167 template<
typename... ElementsA,
typename... ElementsB>
171 if constexpr(
sizeof...(ElementsA) ==
sizeof...(ElementsB))
172 if constexpr(mp_apply<mp_all, mp_transform<std::is_same, mp_list<ElementsA...>, mp_list<ElementsB...>>>::
179 template<
typename... ElementsA,
typename... ElementsB>
188 template<
typename Tuple1,
typename Tuple2,
size_t... Is1,
size_t... Is2>
192 std::index_sequence<Is1...>,
193 std::index_sequence<Is2...>)
195 return Tuple{get<Is1>(t1)..., get<Is2>(t2)...};
200 template<
typename Tuple1,
typename Tuple2>
206 std::make_index_sequence<std::tuple_size_v<Tuple1>>{},
207 std::make_index_sequence<std::tuple_size_v<Tuple2>>{});
215 typename Replacement,
216 std::size_t... IsBefore,
217 std::size_t... IsAfter>
220 Replacement&& replacement,
221 std::index_sequence<IsBefore...>,
222 std::index_sequence<IsAfter...>)
225 get<IsBefore>(std::forward<Tuple>(tuple))...,
226 std::forward<Replacement>(replacement),
227 get<Pos + 1 + IsAfter>(std::forward<Tuple>(tuple))...};
233 template<std::
size_t Pos,
typename Tuple,
typename Replacement>
236 return internal::tupleReplaceImpl<Pos>(
237 std::forward<Tuple>(tuple),
238 std::forward<Replacement>(replacement),
239 std::make_index_sequence<Pos>{},
240 std::make_index_sequence<std::tuple_size_v<std::decay_t<Tuple>> - Pos - 1>{});
245 template<
size_t... Is,
typename... Elements,
typename Functor>
247 std::index_sequence<Is...>,
249 const Functor& functor)
251 return Tuple{functor(get<Is>(tuple))...};
258 template<
typename... Elements,
typename Functor>
267 template<
typename... Elements>
#define LLAMA_DECLSPEC_EMPTY_BASES
#define LLAMA_FN_HOST_ACC_INLINE
constexpr auto tupleReplaceImpl(Tuple &&tuple, Replacement &&replacement, std::index_sequence< IsBefore... >, std::index_sequence< IsAfter... >)
constexpr auto tupleTransformHelper(std::index_sequence< Is... >, const Tuple< Elements... > &tuple, const Functor &functor)
constexpr auto tupleCatImpl(const Tuple1 &t1, const Tuple2 &t2, std::index_sequence< Is1... >, std::index_sequence< Is2... >)
constexpr auto areEqual(const Tuple< Elements... > &a, const Tuple< Elements... > &b, std::index_sequence< Is... >) -> bool
Tuple(Elements...) -> Tuple< std::remove_cv_t< std::remove_reference_t< Elements >>... >
constexpr auto tupleCat(const Tuple1 &t1, const Tuple2 &t2)
constexpr auto operator==(ArrayIndex< TA, Dim > a, ArrayIndex< TB, Dim > b) -> bool
constexpr auto operator!=(ArrayIndex< TA, Dim > a, ArrayIndex< TB, Dim > b) -> bool
constexpr auto get(Tuple< Elements... > &tuple) -> auto &
constexpr auto tupleTransform(const Tuple< Elements... > &tuple, const Functor &functor)
constexpr auto popFront([[maybe_unused]] Array< T, N > a)
constexpr auto tupleReplace(Tuple &&tuple, Replacement &&replacement)
Creates a copy of a tuple with the element at position Pos replaced by replacement.
constexpr auto rest() const -> const RestTuple &
Returns a tuple of all but the first element.
constexpr auto rest() -> RestTuple &
Returns a tuple of all but the first element.
constexpr auto first() const -> decltype(auto)
Returns the first element of the tuple.
constexpr Tuple(FirstElement first, RestElements... rest)
Construct a tuple from values of the same types as the tuple stores.
constexpr Tuple()=default
constexpr auto first() -> decltype(auto)
Returns the first element of the tuple.
TFirstElement FirstElement
constexpr Tuple(T &&firstArg, Ts &&... restArgs)
Construct a tuple from forwarded values of potentially different types as the tuple stores.
constexpr auto value() const -> T
constexpr auto value() const -> const T &
constexpr auto value() -> T &
boost::mp11::mp_at_c< llama::Tuple< Elements... >, I > type