From 10d1597d25fdd3a36e52468f72cf3efde43a9853 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 8 Apr 2024 22:10:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B2=D0=BC=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D1=8C=20=D1=81=20=D0=A1=D0=BC?= =?UTF-8?q?=D0=BE=D0=BB=D0=B5=D0=BD=D1=81=D0=BA=201.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../myx-example-features/private/qasconst.hpp | 23 +++++++++++++++++++ src/myx-example-features/main.cpp | 1 + 2 files changed, 24 insertions(+) create mode 100644 include/myx-example-features/private/qasconst.hpp diff --git a/include/myx-example-features/private/qasconst.hpp b/include/myx-example-features/private/qasconst.hpp new file mode 100644 index 0000000..123a05c --- /dev/null +++ b/include/myx-example-features/private/qasconst.hpp @@ -0,0 +1,23 @@ +#ifndef MYX_BACKPORTS_QASCONST_HPP_ +#define MYX_BACKPORTS_QASCONST_HPP_ + +#pragma once + +#include + +#if QT_VERSION < 0x050700 + +template < typename T > +Q_DECL_CONSTEXPR typename std::add_const< T >::type& qAsConst( T& t ) noexcept +{ + return( t ); +} + + +// prevent rvalue arguments: +template < typename T > +void qAsConst( const T&& ) = delete; + +#endif // if QT_VERSION < 0x050700 + +#endif // ifndef MYX_BACKPORTS_QASCONST_HPP_ diff --git a/src/myx-example-features/main.cpp b/src/myx-example-features/main.cpp index b5b7f9e..3827562 100644 --- a/src/myx-example-features/main.cpp +++ b/src/myx-example-features/main.cpp @@ -3,6 +3,7 @@ */ #include +#include #include