auto.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*=============================================================================
  2. Copyright (c) 2001-2012 Joel de Guzman
  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. #if !defined(BOOST_SPIRIT_AUTO_FEBRUARY_7_2012_0159PM)
  7. #define BOOST_SPIRIT_AUTO_FEBRUARY_7_2012_0159PM
  8. #include <boost/config.hpp>
  9. #include <boost/typeof/typeof.hpp>
  10. #if defined(_MSC_VER)
  11. #pragma once
  12. #endif
  13. #include <boost/config.hpp>
  14. // Support for c++11 auto. See:
  15. // http://boost-spirit.com/home/articles/qi-example/zero-to-60-mph-in-2-seconds/
  16. // for more info
  17. #if defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
  18. #define BOOST_SPIRIT_AUTO(domain_, name, expr) \
  19. typedef boost::proto::result_of:: \
  20. deep_copy<BOOST_TYPEOF(expr)>::type name##_expr_type; \
  21. BOOST_SPIRIT_ASSERT_MATCH( \
  22. boost::spirit::domain_::domain, name##_expr_type); \
  23. BOOST_AUTO(name, boost::proto::deep_copy(expr)); \
  24. /****/
  25. #endif
  26. #endif