1/*
2 * Distributed under the Boost Software License, Version 1.0.
3 * (See accompanying file LICENSE_1_0.txt or copy at
4 * https://www.boost.org/LICENSE_1_0.txt)
5 *
6 * Copyright (c) 2023 Andrey Semashev
7 */
8/*!
9 * \file scope/detail/type_traits/is_invocable.hpp
10 *
11 * This header contains definition of \c is_invocable type trait.
12 */
13
14#ifndef BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_INVOCABLE_HPP_INCLUDED_
15#define BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_INVOCABLE_HPP_INCLUDED_
16
17#include <type_traits>
18#include <boost/scope/detail/config.hpp>
19
20#ifdef BOOST_HAS_PRAGMA_ONCE
21#pragma once
22#endif
23
24#if (defined(__cpp_lib_is_invocable) && (__cpp_lib_is_invocable >= 201703l)) || \
25 (defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (BOOST_CXX_VERSION >= 201703l))
26
27namespace boost {
28namespace scope {
29namespace detail {
30
31using std::is_invocable;
32
33} // namespace detail
34} // namespace scope
35} // namespace boost
36
37#else
38
39namespace boost {
40namespace scope {
41namespace detail {
42
43// A simplified implementation that does not support member function pointers
44template< typename Func, typename... Args >
45struct is_invocable_impl
46{
47 template< typename F = Func, typename = decltype(std::declval< F >()(std::declval< Args >()...)) >
48 static std::true_type _check_invocable(int);
49 static std::false_type _check_invocable(...);
50
51 using type = decltype(is_invocable_impl::_check_invocable(0));
52};
53
54template< typename Func, typename... Args >
55struct is_invocable : public is_invocable_impl< Func, Args... >::type { };
56
57} // namespace detail
58} // namespace scope
59} // namespace boost
60
61#endif
62
63#endif // BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_INVOCABLE_HPP_INCLUDED_
64

source code of boost/libs/scope/include/boost/scope/detail/type_traits/is_invocable.hpp