I have the following code:
#include
#include
class T
{
public:
using Names = std::tuple
@Columbo posted the correct solution.
Unfortunately I am trying to build a header only library. The solution requires that the static member be compiled into one compilation unit (which is what I was using constexpr
in the hopes of avoiding).
So I needed to stick another twist into the works to make it work. This is just to share my solution:
#include
class T
{
public:
using Names = std::tuple;
template
static char const* getName()
{
static constexpr Names names {"First", "Second"};
return std::get(names);
}
};
int main()
{
std::cout << T::getName<0>() << "\n";
}