Only C++17 introduces the rule that static constexpr member variables are implicitly inline.

This commit is contained in:
Roman Telezhynskyi 2022-11-21 08:55:32 +02:00
parent 36fb9db58f
commit 8cd3bfb803
7 changed files with 44 additions and 2 deletions

View File

@ -95,6 +95,11 @@ auto TriangleBasic() -> QPainterPath
}
} // namespace
// See https://stackoverflow.com/a/46719572/3045403
#if __cplusplus < 201703L // C++17
constexpr qreal VPTileFactory::tileStripeWidth; // NOLINT(readability-redundant-declaration)
#endif
//---------------------------------------------------------------------------------------------------------------------
VPTileFactory::VPTileFactory(const VPLayoutPtr &layout, VCommonSettings *commonSettings, QObject *parent):
QObject(parent),

View File

@ -32,6 +32,12 @@
#endif
#include "../ifc/exception/vexception.h"
// See https://stackoverflow.com/a/46719572/3045403
#if __cplusplus < 201703L // C++17
constexpr quint32 VLayoutPlaceLabel::streamHeader; // NOLINT(readability-redundant-declaration)
constexpr quint32 VLayoutPlaceLabel::classVersion; // NOLINT(readability-redundant-declaration)
#endif
//---------------------------------------------------------------------------------------------------------------------
VLayoutPlaceLabel::VLayoutPlaceLabel(const VPlaceLabelItem &item)
: m_center(item.toQPointF()),

View File

@ -83,6 +83,12 @@ private:
QT_WARNING_POP
// See https://stackoverflow.com/a/46719572/3045403
#if __cplusplus < 201703L // C++17
constexpr quint32 VAbstractPieceData::streamHeader; // NOLINT(readability-redundant-declaration)
constexpr quint32 VAbstractPieceData::classVersion; // NOLINT(readability-redundant-declaration)
#endif
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
inline auto operator<<(QDataStream &dataStream, const VAbstractPieceData &piece) -> QDataStream &

View File

@ -127,6 +127,14 @@ private:
static constexpr quint16 classVersion{4};
};
QT_WARNING_POP
// See https://stackoverflow.com/a/46719572/3045403
#if __cplusplus < 201703L // C++17
constexpr quint32 VLayoutPieceData::streamHeader; // NOLINT(readability-redundant-declaration)
constexpr quint32 VLayoutPieceData::classVersion; // NOLINT(readability-redundant-declaration)
#endif
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
inline auto operator<<(QDataStream &dataStream, const VLayoutPieceData &piece) -> QDataStream &
@ -243,6 +251,4 @@ inline auto operator>>(QDataStream &dataStream, VLayoutPieceData &piece) -> QDat
return dataStream;
}
QT_WARNING_POP
#endif // VLAYOUTDETAIL_P_H

View File

@ -80,6 +80,12 @@ private:
QT_WARNING_POP
// See https://stackoverflow.com/a/46719572/3045403
#if __cplusplus < 201703L // C++17
constexpr quint32 VLayoutPiecePathData::streamHeader; // NOLINT(readability-redundant-declaration)
constexpr quint32 VLayoutPiecePathData::classVersion; // NOLINT(readability-redundant-declaration)
#endif
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
QDataStream& operator<<(QDataStream &dataStream, const VLayoutPiecePathData &path)

View File

@ -96,6 +96,13 @@ private:
Q_DECLARE_METATYPE(VSAPoint) // NOLINT
Q_DECLARE_TYPEINFO(VSAPoint, Q_MOVABLE_TYPE); // NOLINT
// See https://stackoverflow.com/a/46719572/3045403
#if __cplusplus < 201703L
constexpr qreal VSAPoint::passmarkFactor; // NOLINT(readability-redundant-declaration)
constexpr qreal VSAPoint::maxPassmarkLength; // NOLINT(readability-redundant-declaration)
constexpr qreal VSAPoint::minSAWidth; // NOLINT(readability-redundant-declaration)
#endif
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint(qreal xpos, qreal ypos)
: VLayoutPoint(xpos, ypos)

View File

@ -116,6 +116,12 @@ private:
static constexpr quint16 classVersion = 2;
};
// See https://stackoverflow.com/a/46719572/3045403
#if __cplusplus < 201703L // C++17
constexpr quint32 VPieceNodeData::streamHeader; // NOLINT(readability-redundant-declaration)
constexpr quint32 VPieceNodeData::classVersion; // NOLINT(readability-redundant-declaration)
#endif
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
QDataStream &operator<<(QDataStream &out, const VPieceNodeData &p)