aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/function_ref.h
diff options
context:
space:
mode:
authorsskvor <sskvor@yandex-team.com>2022-10-07 12:53:10 +0300
committersskvor <sskvor@yandex-team.com>2022-10-07 12:53:10 +0300
commitd10b241085e3d8ea303601bf61d35b2b11ad8146 (patch)
treee00c18a9bc882ca754435d02f90797ed0ccd7d43 /util/generic/function_ref.h
parent67090ca0f04c5c866c38abf31b98de061025c8d4 (diff)
downloadydb-d10b241085e3d8ea303601bf61d35b2b11ad8146.tar.gz
[util] Fix TFunctionRef under MSVC
Diffstat (limited to 'util/generic/function_ref.h')
-rw-r--r--util/generic/function_ref.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/util/generic/function_ref.h b/util/generic/function_ref.h
index c55de8694c..814f0745bf 100644
--- a/util/generic/function_ref.h
+++ b/util/generic/function_ref.h
@@ -5,11 +5,28 @@
#include <functional>
-template <typename Signature>
+namespace NPrivate {
+
+ template <typename Signature>
+ struct TIsNoexcept;
+
+ template <typename Ret, typename... Args>
+ struct TIsNoexcept<Ret(Args...)> {
+ static constexpr bool Value = false;
+ };
+
+ template <typename Ret, typename... Args>
+ struct TIsNoexcept<Ret(Args...) noexcept> {
+ static constexpr bool Value = true;
+ };
+
+} // namespace NPrivate
+
+template <typename Signature, bool IsNoexcept = NPrivate::TIsNoexcept<Signature>::Value>
class TFunctionRef;
template <typename Ret, typename... Args, bool IsNoexcept>
-class TFunctionRef<Ret(Args...) noexcept(IsNoexcept)> {
+class TFunctionRef<Ret(Args...) noexcept(IsNoexcept), IsNoexcept> {
public:
using TSignature = Ret(Args...) noexcept(IsNoexcept);