0

Consider below code:

static constexpr QString FOO = QStringLiteral("foo");

but can not compile this line because QString has not default destructor. How I can do something like this?

H.M
  • 161
  • 11
  • 1
    [Qt vs constexpr string literal](https://stackoverflow.com/questions/56201976/qt-vs-constexpr-string-literal) – Drew Dormann Feb 14 '22 at 19:51
  • https://code.woboq.org/qt5/qtbase/src/corelib/text/qstring.h.html#QLatin1String 1-QLatin1String has not virtual destructor 2- I won't write more class because I want reduce overhead , this create compexity ... (maybe not now ) @DrewDormann – H.M Feb 14 '22 at 20:08

1 Answers1

1

In Qt 6.2 you can use the new u"my string"_qs syntax. https://doc.qt.io/qt-6/qstring.html#operator-22-22_qs

ecloud
  • 171
  • 1
  • 3