diff options
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/util.h b/src/util.h index 7a1c6c109f..2c66104e9d 100644 --- a/src/util.h +++ b/src/util.h @@ -447,8 +447,16 @@ struct MallocedBuffer { MallocedBuffer& operator=(const MallocedBuffer&) = delete; }; -} // namespace node +// Test whether some value can be called with (). +template<typename T, typename = void> +struct is_callable : std::is_function<T> { }; + +template<typename T> +struct is_callable<T, typename std::enable_if< + std::is_same<decltype(void(&T::operator())), void>::value + >::type> : std::true_type { }; +} // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |