summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-02-11 18:05:52 -0800
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-12 20:19:43 +0100
commit8f00f2020b37388ab309fdf39e85a3b3c9814e1d (patch)
treef3a322710879ffcef7a8332a5f5212415224ac59 /src/corelib/tools/qstring.h
parent74f9664f950e9ea4f385cd70f822e10d7be1aca3 (diff)
Leave some Qt 6 remarks for QStringRef
QStringRef could have been trivial. The destructor is empty, the copy constructor copies exactly the members and has an empty body and all the members are POD. Both functions should be removed or defaulted in Qt 6. When the destructor is defaulted, we can make the constructor constexpr. We can't do that now because QStringRef is exported and some nasty compilers (MSVC) like to export all functions, even inline ones, and then call them without emitting a local copy. Change-Id: Ie7509fd1a3f737a6c9156ea078d13bb347fc6be0 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/tools/qstring.h')
-rw-r--r--src/corelib/tools/qstring.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 1e45da060c..9cde603c0b 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1173,13 +1173,17 @@ class Q_CORE_EXPORT QStringRef {
int m_position;
int m_size;
public:
+ // ### Qt 6: make this constructor constexpr, after the destructor is made trivial
inline QStringRef():m_string(0), m_position(0), m_size(0){}
inline QStringRef(const QString *string, int position, int size);
inline QStringRef(const QString *string);
+
+ // ### Qt 6: remove this copy constructor, the implicit one is fine
inline QStringRef(const QStringRef &other)
:m_string(other.m_string), m_position(other.m_position), m_size(other.m_size)
{}
+ // ### Qt 6: remove this destructor, the implicit one is fine
inline ~QStringRef(){}
inline const QString *string() const { return m_string; }
inline int position() const { return m_position; }