I need a class which takes in a compile-time string literal (const char* const) as its only constructor argument.
I would like to have an std::array member variable store the words in this string literal (split up using spaces, for example). The size of this array therefore will never change, as the string literal is known at compile-time.
How can I have this array as a member variable, while having its size be specified by the number of words passed in to the constructor?
I would like to make it so that the caller does not need to specify the number of words in the class template parameters, but that the constructor (presumably a constexpr one) could deduce this at compile time.
I do not want to use a vector, as it is unnecessary for this situation (the words being stored will NEVER change). How would I go about this?
Thanks