Array.hip.hpp 375 Bytes
Newer Older
1
2
#pragma once

Chao Liu's avatar
Chao Liu committed
3
template <class TData, index_t NSize>
4
5
6
7
struct Array
{
    using Type = Array<TData, NSize>;

Chao Liu's avatar
Chao Liu committed
8
    static constexpr index_t nSize = NSize;
9

Chao Liu's avatar
Chao Liu committed
10
    index_t mData[nSize];
11
12

    template <class... Xs>
Chao Liu's avatar
Chao Liu committed
13
    __host__ __device__ Array(Xs... xs) : mData{static_cast<TData>(xs)...}
14
15
16
    {
    }

Chao Liu's avatar
Chao Liu committed
17
    __host__ __device__ TData operator[](index_t i) const { return mData[i]; }
18
};