diff --git a/qtcompat_p.h b/qtcompat_p.h new file mode 100644 index 000000000..52a2e18ee --- /dev/null +++ b/qtcompat_p.h @@ -0,0 +1,41 @@ +/* + Copyright (c) 2017 Kevin Funk + +#if QT_VERSION < QT_VERSION_CHECK(5,7,0) +namespace QtPrivate +{ +template struct QAddConst { + typedef const T Type; +}; +} + +// this adds const to non-const objects (like std::as_const) +template +Q_DECL_CONSTEXPR typename QtPrivate::QAddConst::Type &qAsConst(T &t) Q_DECL_NOTHROW { return t; } +// prevent rvalue arguments: +template +void qAsConst(const T &&) Q_DECL_EQ_DELETE; +#endif + +#endif