I try to create a char* values[]
for my unittests that will be written but initialized from constants. The naive way throws a warning that ISO C++ forbids it:
char* single[1];
single[0] = "foobar";
I tried the following that obviously does not work:
std::string executable = "foobar";
std::array<char, executable.size()> data; // Error: size not known at compile time
std::copy(executable.begin(), executable.end(); data.data());
char* single[1];
single[0] = data.data();
There must be a way like:
std::array<char> data = { "foobar" };
char* single[1];
single[0] = data.data();