I want to do something like this:
template<size_t n>
struct arrayReturn {
int arr[n];
};
auto createArray(const char* input) -> arrayReturn<strlen(input) + 1> {
arrayReturn<strlen(input) + 1> temp;
// copy char* to arr
return temp;
}
or at least something like that, to create a sized int array from a string literal. However, this program is failing to compile because it says strlen(input) +1 cannot be evaluated at compile time. Is there a way I can compute the string literals size at compile time?