"examples/vscode:/vscode.git/clone" did not exist on "745199a86975fb4a1427e20f3ad94070caf0d83c"
Array.hip.hpp 379 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
#pragma once

template <class TData, unsigned NSize>
struct Array
{
    using Type = Array<TData, NSize>;

    static constexpr unsigned nSize = NSize;

    unsigned mData[nSize];

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

    __host__ __device__ TData operator[](unsigned i) const { return mData[i]; }
};