Can C-Strings or std::strings be created as constexpr or must they be created at run-time?
With gcc 4.9.2 I can do this:
constexpr const char foo[] = "blee";
(Sadly the November 2013 Customer Technology Preview does not allow Visual Studio to support this: http://ift.tt/19PeZWY)
But even with gcc 4.9.2 I cannot do this:
constexpr const std::string foo = "blee";
I get the error:
the type '
const string{akaconst std::basic_string<char>}' ofconstexprvariable 'foo' is not literal
Does this mean that the conversion from "blee" to a std::string isn't defined until run-time, or that std::string can't be a literal, or what?
Aucun commentaire:
Enregistrer un commentaire