is_parser.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. /*=============================================================================
  2. Copyright (c) 2001-2014 Joel de Guzman
  3. Copyright (c) 2014 Agustin Berge
  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)
  6. ==============================================================================*/
  7. #if !defined(BOOST_SPIRIT_X3_IS_PARSER_MAY_20_2013_0235PM)
  8. #define BOOST_SPIRIT_X3_IS_PARSER_MAY_20_2013_0235PM
  9. #include <boost/mpl/bool.hpp>
  10. #include <boost/spirit/home/x3/core/parser.hpp>
  11. #include <boost/spirit/home/x3/support/utility/sfinae.hpp>
  12. namespace boost { namespace spirit { namespace x3 { namespace traits
  13. {
  14. ///////////////////////////////////////////////////////////////////////////
  15. // is_parser<T>: metafunction that evaluates to mpl::true_ if a type T
  16. // can be used as a parser, mpl::false_ otherwise
  17. ///////////////////////////////////////////////////////////////////////////
  18. template <typename T, typename Enable = void>
  19. struct is_parser
  20. : mpl::false_
  21. {};
  22. template <typename T>
  23. struct is_parser<T, typename disable_if_substitution_failure<
  24. typename extension::as_parser<T>::type>::type>
  25. : mpl::true_
  26. {};
  27. }}}}
  28. #endif