From 261e73bf3e01ec9b0caacea207c8cd6b47c78195 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 9 May 2022 12:07:13 +0200 Subject: [PATCH] y_combinator: conditionally noexcept --- src/entt/core/utility.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/entt/core/utility.hpp b/src/entt/core/utility.hpp index c938f81d9..e38f68942 100644 --- a/src/entt/core/utility.hpp +++ b/src/entt/core/utility.hpp @@ -1,6 +1,7 @@ #ifndef ENTT_CORE_UTILITY_HPP #define ENTT_CORE_UTILITY_HPP +#include #include namespace entt { @@ -71,7 +72,7 @@ struct y_combinator { * @brief Constructs a y-combinator from a given function. * @param recursive A potentially recursive function. */ - constexpr y_combinator(Func recursive) + constexpr y_combinator(Func recursive) noexcept(std::is_nothrow_move_constructible_v) : func{std::move(recursive)} {} /** @@ -81,13 +82,13 @@ struct y_combinator { * @return Return value of the underlying function, if any. */ template - constexpr decltype(auto) operator()(Args &&...args) const { + constexpr decltype(auto) operator()(Args &&...args) const noexcept(std::is_nothrow_invocable_v) { return func(*this, std::forward(args)...); } /*! @copydoc operator()() */ template - constexpr decltype(auto) operator()(Args &&...args) { + constexpr decltype(auto) operator()(Args &&...args) noexcept(std::is_nothrow_invocable_v) { return func(*this, std::forward(args)...); }