21 template <
typename Key,
typename Data>
43 template <
typename Key,
typename Data>
44 __host__ __device__ constexpr
const Data&
47 return static_cast<const Data&
>(x.
mData);
51 template <
typename Key,
typename Data>
52 __host__ __device__ constexpr Data&
59 template <
typename Key,
typename Data>
60 __host__ __device__ constexpr Data&&
63 return static_cast<Data&&
>(x.mData);
67 template <
typename Key,
typename Data>
70 return ck::forward(x.
mData);
73 template <
typename Indices,
typename... Xs>
76 template <
index_t... Is,
typename... Xs>
79 __host__ __device__ constexpr
TupleImpl() =
default;
82 typename enable_if<
sizeof...(Is) == 1 &&
sizeof...(Xs) == 1 &&
90 template <
typename... Ys,
typename enable_if<
sizeof...(Ys) >= 2,
bool>::type =
false>
91 __host__ __device__ constexpr
TupleImpl(Ys&&... ys)
94 static_assert(
sizeof...(Is) ==
sizeof...(Xs) &&
sizeof...(Is) ==
sizeof...(Ys),
95 "wrong! inconsistent size");
98 __host__ __device__
static constexpr
index_t Size() {
return sizeof...(Xs); }
103 return get_tuple_element_data_reference<TupleElementKey<I>>(*this);
109 return get_tuple_element_data_reference<TupleElementKey<I>>(*this);
115 template <
typename... Xs>
121 __host__ __device__ constexpr
Tuple() =
default;
123 template <
typename Y,
126 __host__ __device__ constexpr
Tuple(Y&& y) :
base(ck::forward<Y>(y))
130 template <
typename... Ys,
131 typename enable_if<
sizeof...(Ys) ==
sizeof...(Xs) &&
sizeof...(Ys) >= 2,
bool>::type =
133 __host__ __device__ constexpr
Tuple(Ys&&... ys) :
base(ck::forward<Ys>(ys)...)
137 __host__ __device__
static constexpr
index_t Size() {
return sizeof...(Xs); }
141 __host__ __device__ constexpr
const auto& At(Number<I>)
const
143 static_assert(I < base::Size(),
"wrong! out of range");
144 return base::GetElementDataByKey(detail::TupleElementKey<I>{});
149 __host__ __device__ constexpr
auto& At(Number<I>)
151 static_assert(I < base::Size(),
"wrong! out of range");
152 return base::GetElementDataByKey(detail::TupleElementKey<I>{});
157 __host__ __device__ constexpr
const auto& operator[](Number<I> i)
const
164 __host__ __device__ constexpr
auto& operator()(Number<I> i)
169 template <
typename T>
170 __host__ __device__ constexpr
auto operator=(
const T&
a)
172 static_assert(T::Size() == Size(),
"wrong! size not the same");
174 static_for<0, Size(), 1>{}([&](
auto i) { operator()(i) =
a[i]; });
179 __host__ __device__
static constexpr
bool IsStaticBuffer() {
return true; }
181 __host__ __device__
static constexpr
bool IsTuple() {
return true; }
187 __host__ __device__ constexpr
Tuple() =
default;
191 template <
typename T>
200 template <index_t I,
typename TTuple>
207 template <index_t I,
typename TTuple>
210 template <
typename... Xs>
217 template <
typename... Args>
218 constexpr
Tuple<Args&...>
tie(Args&... args) noexcept
__host__ constexpr __device__ Data get_tuple_element_data(const TupleElementKeyData< Key, Data > &x)
Definition: tuple.hpp:68
__host__ constexpr __device__ const Data & get_tuple_element_data_reference(const TupleElementKeyData< Key, Data > &x)
Definition: tuple.hpp:45
typename tuple_element< I, TTuple >::type tuple_element_t
Definition: tuple.hpp:208
constexpr Tuple< Args &... > tie(Args &... args) noexcept
Definition: tuple.hpp:218
std::enable_if< B, T > enable_if
Definition: enable_if.hpp:24
__host__ constexpr __device__ auto make_tuple(Xs &&... xs)
Definition: tuple.hpp:211
remove_cv_t< remove_reference_t< T > > remove_cvref_t
Definition: type.hpp:297
int32_t index_t
Definition: ck.hpp:298
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1350
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1249
Definition: sequence.hpp:43
__host__ static constexpr __device__ index_t Size()
Definition: tuple.hpp:189
__host__ constexpr __device__ auto operator=(const T &)
Definition: tuple.hpp:192
__host__ static constexpr __device__ bool IsStaticBuffer()
Definition: tuple.hpp:197
__host__ constexpr __device__ Tuple()=default
Definition: tuple.hpp:117
__host__ constexpr __device__ Tuple(Y &&y)
Definition: tuple.hpp:126
detail::TupleImpl< typename arithmetic_sequence_gen< 0, sizeof...(Xs), 1 >::type, Xs... > base
Definition: tuple.hpp:119
__host__ constexpr __device__ Tuple()=default
Definition: sequence.hpp:256
__host__ constexpr __device__ TupleElementKeyData(T &&v)
Definition: tuple.hpp:35
Data DataType
Definition: tuple.hpp:24
DataType mData
Definition: tuple.hpp:39
__host__ constexpr __device__ TupleElementKeyData()
Definition: tuple.hpp:29
__host__ constexpr __device__ TupleElementKey()=default
__host__ constexpr __device__ auto & GetElementDataByKey(TupleElementKey< I >)
Definition: tuple.hpp:107
__host__ constexpr __device__ TupleImpl()=default
__host__ constexpr __device__ TupleImpl(Y &&y)
Definition: tuple.hpp:85
__host__ static constexpr __device__ index_t Size()
Definition: tuple.hpp:98
__host__ constexpr __device__ const auto & GetElementDataByKey(TupleElementKey< I >) const
Definition: tuple.hpp:101
Definition: tuple.hpp:202
decltype(detail::get_tuple_element_data< detail::TupleElementKey< I > >(TTuple{})) type
Definition: tuple.hpp:204