C ++ Статический шаблон ContexPR в структуре [дубликат]C++

Программы на C++. Форум разработчиков
Anonymous
C ++ Статический шаблон ContexPR в структуре [дубликат]

Сообщение Anonymous »

Я сократил свой код до следующего минимального примера:

Код: Выделить всё

#include
#include
#include 

enum Indices : std::uint16_t
{
kIndex1 = 0,
kIndex2 = 1,
kNumIndices = 2
};

struct TestStruct
{
static constexpr std::array myvals{4,7};

template 
static constexpr std::uint32_t GetValue()
{
return myvals[myIndex]*5;
}

static constexpr std::array newVals{GetValue(), GetValue()};
};

int main()
{
auto myArr = TestStruct::newVals;
std::cout

Подробнее здесь: [url]https://stackoverflow.com/questions/79384568/c-static-constexpr-template-function-in-struct[/url]

Вернуться в «C++»