When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
12 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
How about try c++20
I think that's when limited support for constexpr std string was added
a constexpr std::string just generally doesn't make sense and shouldn't be attempted to be used
the fact that it works with clang is more or less due to all the strings being small and fitting into sso buffer, but that behaviour is not mandated and not portable
just use a string view
assuming every thing is from a string literal at least
and if you have more complex things that you cannot turn into a "constexpr array of character" and you need to actually allocate things, then remove constexpr
this "limited support for constexpr std string" mostly relates to using std::string (and a couple of other things that need to perform allocation) inside of a constexpr function, and the rule you must follow to benefit from that limited support is that no "constexpr allocation" may ever "leak" to the runtime
everything you allocate within the constexpr context must be deallocated within the constexpr context
trying to create a constexpr string object/variable is just not allowed
Thank you and let us know if you have any more questions!
This thread is now set to auto-hide after an hour of inactivity