clang-tidy: performance-noexcept-move-constructor (#1063)

I ran GSL through clang-tidy with the performance-* checks

https://releases.llvm.org/15.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/performance/noexcept-move-constructor.html
This commit is contained in:
jpr42 2022-11-01 11:07:47 -06:00 committed by GitHub
parent 9c4212aca4
commit d69e578519
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -267,7 +267,9 @@ public:
constexpr strict_not_null(const strict_not_null<U>& other) : not_null<T>(other) constexpr strict_not_null(const strict_not_null<U>& other) : not_null<T>(other)
{} {}
strict_not_null(strict_not_null&& other) = default; // To avoid invalidating the "not null" invariant, the contained pointer is actually copied
// instead of moved. If it is a custom pointer, its constructor could in theory throw exceptions.
strict_not_null(strict_not_null&& other) noexcept(std::is_nothrow_copy_constructible<T>::value) = default;
strict_not_null(const strict_not_null& other) = default; strict_not_null(const strict_not_null& other) = default;
strict_not_null& operator=(const strict_not_null& other) = default; strict_not_null& operator=(const strict_not_null& other) = default;
strict_not_null& operator=(const not_null<T>& other) strict_not_null& operator=(const not_null<T>& other)

View File

@ -437,13 +437,13 @@ public:
constexpr basic_zstring_span(const basic_zstring_span& other) = default; constexpr basic_zstring_span(const basic_zstring_span& other) = default;
// move // move
constexpr basic_zstring_span(basic_zstring_span && other) = default; constexpr basic_zstring_span(basic_zstring_span && other) noexcept = default;
// assign // assign
constexpr basic_zstring_span& operator=(const basic_zstring_span& other) = default; constexpr basic_zstring_span& operator=(const basic_zstring_span& other) = default;
// move assign // move assign
constexpr basic_zstring_span& operator=(basic_zstring_span&& other) = default; constexpr basic_zstring_span& operator=(basic_zstring_span&& other) noexcept = default;
constexpr bool empty() const noexcept { return false; } constexpr bool empty() const noexcept { return false; }