diff --git a/src/gui/util/qgridlayoutengine_p.h b/src/gui/util/qgridlayoutengine_p.h index e00c2c5e483..159e4a5a25a 100644 --- a/src/gui/util/qgridlayoutengine_p.h +++ b/src/gui/util/qgridlayoutengine_p.h @@ -72,12 +72,14 @@ class QHVContainer { static_assert(Qt::Horizontal == 0x1); static_assert(Qt::Vertical == 0x2); - static constexpr int map(Qt::Orientation o) noexcept + static constexpr int map(Qt::Orientation o) { + Q_ASSERT(o == Qt::Horizontal || o == Qt::Vertical); // Q_PRE return int(o) - 1; } - static constexpr int mapOther(Qt::Orientation o) noexcept + static constexpr int mapOther(Qt::Orientation o) { + Q_ASSERT(o == Qt::Horizontal || o == Qt::Vertical); // Q_PRE return 2 - int(o); } public: @@ -86,11 +88,11 @@ public: : m_data{h, v} {} QHVContainer() = default; - constexpr T &operator[](Qt::Orientation o) noexcept { return m_data[map(o)]; } - constexpr const T &operator[](Qt::Orientation o) const noexcept { return m_data[map(o)]; } + constexpr T &operator[](Qt::Orientation o) { return m_data[map(o)]; } + constexpr const T &operator[](Qt::Orientation o) const { return m_data[map(o)]; } - constexpr T &other(Qt::Orientation o) noexcept { return m_data[mapOther(o)]; } - constexpr const T &other(Qt::Orientation o) const noexcept { return m_data[mapOther(o)]; } + constexpr T &other(Qt::Orientation o) { return m_data[mapOther(o)]; } + constexpr const T &other(Qt::Orientation o) const { return m_data[mapOther(o)]; } constexpr void transpose() noexcept { qSwap(m_data[0], m_data[1]); } constexpr QHVContainer transposed() const