Require that the handle type used with QUniqueHandle is quite noexcept
QUniqueHandle is intended for handle types or opaque pointers that are no-throw constructible, copyable, and assignable, and has nothrow comparison and relation operators. This patch ensures that this holds true, and makes most of the QUniqueHandle noexcept specifiers valid. This will make it easier to implement the comparison and relation operators in terms of the Qt comparison framework. Task-number: QTBUG-132507 Pick-to: 6.8 6.9 Change-Id: Id9fc3fac72a2337541e49c3b4613b8fd082796af Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
57f44d6d88
commit
49f1877bbb
@ -20,6 +20,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -109,6 +110,19 @@ class QUniqueHandle
|
||||
{
|
||||
public:
|
||||
using Type = typename HandleTraits::Type;
|
||||
static_assert(std::is_nothrow_default_constructible_v<Type>);
|
||||
static_assert(std::is_nothrow_constructible_v<Type>);
|
||||
static_assert(std::is_nothrow_copy_constructible_v<Type>);
|
||||
static_assert(std::is_nothrow_move_constructible_v<Type>);
|
||||
static_assert(std::is_nothrow_copy_assignable_v<Type>);
|
||||
static_assert(std::is_nothrow_move_assignable_v<Type>);
|
||||
static_assert(std::is_nothrow_destructible_v<Type>);
|
||||
static_assert(noexcept(std::declval<Type>() == std::declval<Type>()));
|
||||
static_assert(noexcept(std::declval<Type>() != std::declval<Type>()));
|
||||
static_assert(noexcept(std::declval<Type>() < std::declval<Type>()));
|
||||
static_assert(noexcept(std::declval<Type>() <= std::declval<Type>()));
|
||||
static_assert(noexcept(std::declval<Type>() > std::declval<Type>()));
|
||||
static_assert(noexcept(std::declval<Type>() >= std::declval<Type>()));
|
||||
|
||||
QUniqueHandle() = default;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user