pseudo_attribute.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*=============================================================================
  2. Copyright (c) 2019 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_X3_PSEUDO_ATTRIBUTE_OF_MAY_15_2019_1012PM)
  7. #define BOOST_SPIRIT_X3_PSEUDO_ATTRIBUTE_OF_MAY_15_2019_1012PM
  8. #include <utility>
  9. namespace boost { namespace spirit { namespace x3 { namespace traits
  10. {
  11. ///////////////////////////////////////////////////////////////////////////
  12. // Pseudo attributes are placeholders for parsers that can only know
  13. // its actual attribute at parse time. This trait customization point
  14. // provides a mechanism to convert the trait to the actual trait at
  15. // parse time.
  16. ///////////////////////////////////////////////////////////////////////////
  17. template <typename Context, typename Attribute, typename Iterator
  18. , typename Enable = void>
  19. struct pseudo_attribute
  20. {
  21. using attribute_type = Attribute;
  22. using type = Attribute;
  23. static type&& call(Iterator&, Iterator const&, attribute_type&& attr)
  24. {
  25. return std::forward<type>(attr);
  26. }
  27. };
  28. }}}}
  29. #endif