is_callable.hpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  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. namespace boost { namespace spirit { namespace x3 { namespace detail
  10. {
  11. template <typename Sig, typename Enable = void>
  12. struct is_callable_impl : mpl::false_ {};
  13. template <typename F, typename... A>
  14. struct is_callable_impl<F(A...),
  15. decltype(void(std::declval<F>()(std::declval<A>()...)))>
  16. : mpl::true_
  17. {};
  18. }}}}
  19. namespace boost { namespace spirit { namespace x3
  20. {
  21. template <typename Sig>
  22. struct is_callable;
  23. template <typename F, typename... A>
  24. struct is_callable<F(A...)> : detail::is_callable_impl<F(A...)> {};
  25. }}}
  26. #endif