[Development] Proposal: Deprecating platforms in Qt 5.6 that don't support lambda
Marc Mutz
marc.mutz at kdab.com
Wed Dec 16 15:08:25 CET 2015
On Wednesday 16 December 2015 15:01:23 Marc Mutz wrote:
> // assume the following are friends of QContainerWrapper<T/T&>,
> resp.: template <typename T>
> QContainerWrapper<T&> qAsConst(const T &t) // lvalue
> Q_DECL_NOTHROW
> { return {t}; } // stores reference
> template <typename T>
> QContainerWrapper<T> qAsConst(const T &&t)
> Q_DECL_NOEXCEPT_EXPR(std::is_nothrow_move_constructible_v<T>)
> { return {std::move(t)}; } // stores a copy
Actually, this would be even simpler:
template <typename T>
Q_DECL_CONSTEXPR const T &qAsConst(const T &t) Q_DECL_NOTHROW
{ return t; }
template <typename T>
Q_DECL_CONSTEXPR const T qAsConst(T &&t)
Q_DECL_NOEXCEPT_EXPR(std::is_nothrow_move_constructible_v<T>)
{ return std::move(t); }
--
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts
More information about the Development
mailing list