what.hpp 961 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (c) 2001-2011 Hartmut Kaiser
  2. //
  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. #if !defined(BOOST_SPIRIT_WHAT_MAY_04_2007_0116PM)
  6. #define BOOST_SPIRIT_WHAT_MAY_04_2007_0116PM
  7. #if defined(_MSC_VER)
  8. #pragma once
  9. #endif
  10. #include <boost/mpl/assert.hpp>
  11. #include <boost/spirit/home/support/info.hpp>
  12. #include <boost/spirit/home/karma/meta_compiler.hpp>
  13. namespace boost { namespace spirit { namespace karma
  14. {
  15. template <typename Expr>
  16. inline info what(Expr const& xpr)
  17. {
  18. // Report invalid expression error as early as possible.
  19. // If you got an error_invalid_expression
  20. // error message here, then the expression (expr) is not a
  21. // valid spirit karma expression.
  22. BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
  23. return compile<karma::domain>(xpr).what(unused);
  24. }
  25. }}}
  26. #endif