diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 38d322a..534ff41 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: # This brings in a portable version of clang-format. # See also: https://github.com/ssciwr/clang-format-wheel - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v22.1.8 + rev: v23.1.1 hooks: - id: clang-format types_or: [c++, c] @@ -23,7 +23,7 @@ repos: # CMake linting and formatting - repo: https://github.com/BlankSpruce/gersemi-pre-commit - rev: 0.28.0 + rev: 0.29.1 hooks: - id: gersemi name: CMake linting diff --git a/include/beman/expected/expected.hpp b/include/beman/expected/expected.hpp index f4c0ad1..56e7e0a 100644 --- a/include/beman/expected/expected.hpp +++ b/include/beman/expected/expected.hpp @@ -178,9 +178,9 @@ class expected { std::is_constructible_v && (std::is_same_v> || !detail::converts_from_any_cvref>) && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr explicit(!std::is_convertible_v || !std::is_convertible_v) expected(const expected& rhs); @@ -189,9 +189,9 @@ class expected { requires(!std::is_reference_v && std::is_constructible_v && std::is_constructible_v && (std::is_same_v> || !detail::converts_from_any_cvref>) && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr explicit(!std::is_convertible_v || !std::is_convertible_v) expected(expected&& rhs); // Converting constructor from expected — reference-E path: only accepts sources @@ -203,7 +203,7 @@ class expected { expected(const expected& rhs); template - requires(std::is_reference_v && std::is_reference_v && std::is_constructible_v && + requires(std::is_reference_v && std::is_reference_v && std::is_constructible_v && std::is_convertible_v) constexpr explicit(!std::is_convertible_v || !std::is_convertible_v) expected(expected&& rhs); @@ -587,9 +587,9 @@ template requires(!std::is_reference_v && std::is_constructible_v && std::is_constructible_v && (std::is_same_v> || !detail::converts_from_any_cvref>) && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr expected::expected(const expected& rhs) : has_val_(rhs.has_value()) { if (has_val_) std::construct_at(std::addressof(val_), *rhs); @@ -602,9 +602,9 @@ template requires(!std::is_reference_v && std::is_constructible_v && std::is_constructible_v && (std::is_same_v> || !detail::converts_from_any_cvref>) && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr expected::expected(expected&& rhs) : has_val_(rhs.has_value()) { if (has_val_) std::construct_at(std::addressof(val_), *std::move(rhs)); @@ -625,7 +625,7 @@ constexpr expected::expected(const expected& rhs) : has_val_(rhs.has template template - requires(std::is_reference_v && std::is_reference_v && std::is_constructible_v && + requires(std::is_reference_v && std::is_reference_v && std::is_constructible_v && std::is_convertible_v) constexpr expected::expected(expected&& rhs) : has_val_(rhs.has_value()) { if (has_val_) @@ -1456,17 +1456,17 @@ class expected { template requires(std::is_void_v && !std::is_reference_v && !std::is_same_v && std::is_constructible_v && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr explicit(!std::is_convertible_v) expected(const expected& rhs); template requires(std::is_void_v && !std::is_reference_v && !std::is_same_v && std::is_constructible_v && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr explicit(!std::is_convertible_v) expected(expected&& rhs); // Constructor from unexpected const& / && — value-E path @@ -1777,9 +1777,9 @@ template template requires(std::is_void_v && !std::is_reference_v && !std::is_same_v && std::is_constructible_v && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr expected::expected(const expected& rhs) : has_val_(rhs.has_value()) { if (!has_val_) std::construct_at(std::addressof(unex_), rhs.error()); @@ -1789,9 +1789,9 @@ template template requires(std::is_void_v && !std::is_reference_v && !std::is_same_v && std::is_constructible_v && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr expected::expected(expected&& rhs) : has_val_(rhs.has_value()) { if (!has_val_) std::construct_at(std::addressof(unex_), std::move(rhs).error()); diff --git a/include/beman/expected/unexpected.hpp b/include/beman/expected/unexpected.hpp index dbfc428..f8cab35 100644 --- a/include/beman/expected/unexpected.hpp +++ b/include/beman/expected/unexpected.hpp @@ -136,7 +136,7 @@ class unexpected { // Binds E& directly to the referenced object; deleted below when G would bind to a temporary. template requires(!std::is_same_v, unexpected> && - !std::is_same_v, std::in_place_t> && std::is_constructible_v && + !std::is_same_v, std::in_place_t> && std::is_constructible_v && !detail::reference_constructs_from_temporary_v) constexpr explicit unexpected(G&& e) noexcept : ptr_(std::addressof(static_cast(std::forward(e)))) {} @@ -149,7 +149,7 @@ class unexpected { // Deleted catch-all: neither constructible nor a dangling case template requires(!std::is_same_v, unexpected> && - !std::is_same_v, std::in_place_t> && !std::is_constructible_v && + !std::is_same_v, std::in_place_t> && !std::is_constructible_v && !detail::reference_constructs_from_temporary_v) constexpr unexpected(G&&) = BEMAN_EXPECTED_DELETE_MSG("unexpected: no viable conversion from the given argument to E&"); @@ -159,7 +159,7 @@ class unexpected { // reference or not. Naturally restricted to arity 1: there is no variadic overload here, // and expected only ever calls this when is_constructible_v already holds. template - requires(std::is_constructible_v && !detail::reference_constructs_from_temporary_v) + requires(std::is_constructible_v && !detail::reference_constructs_from_temporary_v) constexpr explicit unexpected(std::in_place_t, G&& e) noexcept : ptr_(std::addressof(static_cast(std::forward(e)))) {}