empty.hpp 985 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef BOOST_METAPARSE_V1_EMPTY_HPP
  2. #define BOOST_METAPARSE_V1_EMPTY_HPP
  3. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2010 - 2011.
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #include <boost/metaparse/v1/error/end_of_input_expected.hpp>
  8. #include <boost/metaparse/v1/reject.hpp>
  9. #include <boost/metaparse/v1/accept.hpp>
  10. #include <boost/metaparse/v1/define_error.hpp>
  11. #include <boost/mpl/empty.hpp>
  12. #include <boost/mpl/if.hpp>
  13. namespace boost
  14. {
  15. namespace metaparse
  16. {
  17. namespace v1
  18. {
  19. template <class Result>
  20. struct empty
  21. {
  22. typedef empty type;
  23. template <class S, class Pos>
  24. struct apply :
  25. boost::mpl::if_<
  26. boost::mpl::empty<S>,
  27. accept<Result, S, Pos>,
  28. reject<error::end_of_input_expected, Pos>
  29. >
  30. {};
  31. };
  32. }
  33. }
  34. }
  35. #endif