is_callable.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*//////////////////////////////////////////////////////////////////////////////
  2. Copyright (c) 2014 Jamboree
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. //////////////////////////////////////////////////////////////////////////////*/
  6. #ifndef BOOST_SPIRIT_X3_IS_CALLABLE_HPP_INCLUDED
  7. #define BOOST_SPIRIT_X3_IS_CALLABLE_HPP_INCLUDED
  8. #include <boost/mpl/bool.hpp>
  9. #include <boost/spirit/home/x3/support/utility/sfinae.hpp>
  10. namespace boost { namespace spirit { namespace x3 { namespace detail
  11. {
  12. template <typename Sig, typename Enable = void>
  13. struct is_callable_impl : mpl::false_ {};
  14. template <typename F, typename... A>
  15. struct is_callable_impl<F(A...), typename disable_if_substitution_failure<
  16. decltype(std::declval<F>()(std::declval<A>()...))>::type>
  17. : mpl::true_
  18. {};
  19. }}}}
  20. namespace boost { namespace spirit { namespace x3
  21. {
  22. template <typename Sig>
  23. struct is_callable;
  24. template <typename F, typename... A>
  25. struct is_callable<F(A...)> : detail::is_callable_impl<F(A...)> {};
  26. }}}
  27. #endif