From b8cf34c691623e4ec329053cbbf68522a855882d Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Thu, 5 Dec 2019 15:12:59 +0900 Subject: Imported Upstream version 1.67.0 --- boost/hof/is_invocable.hpp | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 boost/hof/is_invocable.hpp (limited to 'boost/hof/is_invocable.hpp') diff --git a/boost/hof/is_invocable.hpp b/boost/hof/is_invocable.hpp new file mode 100644 index 0000000000..edf736e1b2 --- /dev/null +++ b/boost/hof/is_invocable.hpp @@ -0,0 +1,72 @@ +/*============================================================================= + Copyright (c) 2014 Paul Fultz II + is_invocable.h + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#ifndef BOOST_HOF_GUARD_IS_CALLABLE_H +#define BOOST_HOF_GUARD_IS_CALLABLE_H + +/// is_invocable +/// =========== +/// +/// Description +/// ----------- +/// +/// The `is_invocable` metafunction checks if the function is callable with +/// certain parameters. +/// +/// Requirements +/// ------------ +/// +/// F must be: +/// +/// * [Invocable](Invocable) +/// +/// Synopsis +/// -------- +/// +/// template +/// struct is_invocable; +/// +/// Example +/// ------- +/// +/// #include +/// using namespace boost::hof; +/// +/// struct is_invocable_class +/// { +/// void operator()(int) const +/// { +/// } +/// }; +/// static_assert(is_invocable(), "Not callable"); +/// +/// int main() {} +/// + + +#include +#include + +namespace boost { namespace hof { + +template +struct is_invocable +: detail::can_be_called +{}; + +template +struct is_invocable +{ + static_assert(!std::is_same::value, + "The is_invocable form is not supported because it is problematic." + "Please use is_invocable instead." + ); +}; + +}} // namespace boost::hof + +#endif -- cgit v1.2.3