2 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // Official repository: https://github.com/boostorg/beast
10 #ifndef BOOST_BEAST_TYPE_TRAITS_HPP
11 #define BOOST_BEAST_TYPE_TRAITS_HPP
13 #ifndef BOOST_BEAST_DOXYGEN
15 #include <boost/beast/core/detail/config.hpp>
16 #include <boost/beast/core/detail/is_invocable.hpp>
17 #include <boost/config/pragma_message.hpp>
18 #include <type_traits.hpp>
20 BOOST_PRAGMA_MESSAGE("<boost/beast/core/type_traits.hpp> is DEPRECATED and will be removed in a future release.")
25 /** Determine if `T` meets the requirements of <em>CompletionHandler</em>.
27 This trait checks whether a type meets the requirements for a completion
28 handler, and is also callable with the specified signature.
29 Metafunctions are used to perform compile time checking of template
30 types. This type will be `std::true_type` if `T` meets the requirements,
31 else the type will be `std::false_type`.
34 Use with `static_assert`:
38 void operator()(error_code&);
40 static_assert(is_completion_handler<handler, void(error_code&)>::value,
41 "Not a completion handler");
44 template<class T, class Signature>
45 #if BOOST_BEAST_DOXYGEN
46 using is_completion_handler = __see_below__
48 using is_completion_handler = std::integral_constant<bool,
49 std::is_move_constructible<typename std::decay<T>::type>::value &&
50 detail::is_invocable<T, Signature>::value>;