14 template <
typename TData, index_t NSize>
22 __host__ __device__
static constexpr
index_t Size() {
return NSize; }
24 __host__ __device__ constexpr
const TData&
At(
index_t i)
const {
return mData[i]; }
32 template <
typename... Args>
36 assert(i >= 0 && i < NSize);
38 new(
mData + i) TData(ck::forward<Args>(args)...);
44 static_assert(T::Size() ==
Size(),
"wrong! size not the same");
50 __host__ __device__ constexpr
const TData*
begin()
const {
return &
mData[0]; }
51 __host__ __device__ constexpr
const TData*
end()
const {
return &
mData[NSize]; }
52 __host__ __device__ constexpr TData*
begin() {
return &
mData[0]; }
53 __host__ __device__ constexpr TData*
end() {
return &
mData[NSize]; }
57 template <
typename TData>
63 __host__ __device__
static constexpr
index_t Size() {
return 0; }
66 template <
typename X,
typename... Xs>
67 __host__ __device__ constexpr
auto make_array(X&& x, Xs&&... xs)
70 return Array<data_type,
sizeof...(Xs) + 1>{ck::forward<X>(x), ck::forward<Xs>(xs)...};
__host__ constexpr __device__ auto make_array(X &&x, Xs &&... xs)
Definition: array.hpp:67
remove_cv_t< remove_reference_t< T > > remove_cvref_t
Definition: type.hpp:297
int32_t index_t
Definition: ck.hpp:301
typename std::enable_if< B, T >::type enable_if_t
Definition: enable_if.hpp:27
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1517
TData data_type
Definition: array.hpp:61
__host__ static constexpr __device__ index_t Size()
Definition: array.hpp:63
__host__ constexpr __device__ TData * begin()
Definition: array.hpp:52
__host__ constexpr __device__ TData * end()
Definition: array.hpp:53
__host__ constexpr __device__ const TData & At(index_t i) const
Definition: array.hpp:24
__host__ constexpr __device__ TData & operator()(index_t i)
Definition: array.hpp:30
__host__ constexpr __device__ const TData * begin() const
Definition: array.hpp:50
TData mData[NSize]
Definition: array.hpp:20
__host__ constexpr __device__ TData & At(index_t i)
Definition: array.hpp:26
__host__ constexpr __device__ auto operator=(const T &a)
Definition: array.hpp:42
constexpr __host__ auto Emplace(index_t i, Args &&... args) -> std::enable_if_t< std::is_nothrow_constructible_v< TData, Args &&... >>
Definition: array.hpp:33
__host__ constexpr __device__ const TData * end() const
Definition: array.hpp:51
__host__ constexpr __device__ const TData & operator[](index_t i) const
Definition: array.hpp:28
TData data_type
Definition: array.hpp:18
__host__ static constexpr __device__ index_t Size()
Definition: array.hpp:22
Definition: functional2.hpp:33