util/BindMethod: add constexpr

This commit is contained in:
Max Kellermann 2023-10-02 21:45:59 +02:00 committed by Max Kellermann
parent 63d865666e
commit 7e6941acc8

View File

@ -29,7 +29,7 @@ public:
/** /**
* Non-initializing trivial constructor * Non-initializing trivial constructor
*/ */
BoundMethod() = default; constexpr BoundMethod() = default;
constexpr constexpr
BoundMethod(void *_instance, function_pointer _function) noexcept BoundMethod(void *_instance, function_pointer _function) noexcept
@ -39,12 +39,12 @@ public:
* Construct an "undefined" object. It must not be called, * Construct an "undefined" object. It must not be called,
* and its "bool" operator returns false. * and its "bool" operator returns false.
*/ */
BoundMethod(std::nullptr_t) noexcept:function(nullptr) {} constexpr BoundMethod(std::nullptr_t) noexcept:function(nullptr) {}
/** /**
* Was this object initialized with a valid function pointer? * Was this object initialized with a valid function pointer?
*/ */
operator bool() const noexcept { constexpr operator bool() const noexcept {
return function != nullptr; return function != nullptr;
} }