#constexpr std::to_array<std::string>

12 messages · Page 1 of 1 (latest)

mystic bloomBOT
#

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.

clever juniper
#

How about try c++20

#

I think that's when limited support for constexpr std string was added

lofty kindle
#

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

lofty kindle
#

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

mystic bloomBOT
#

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