nothing.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*==============================================================================
  2. Copyright (c) 2005-2010 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. #ifndef BOOST_PHOENIX_CORE_NOTHING_HPP
  7. #define BOOST_PHOENIX_CORE_NOTHING_HPP
  8. #include <boost/phoenix/core/limits.hpp>
  9. #include <boost/mpl/void.hpp>
  10. #include <boost/phoenix/core/actor.hpp>
  11. #include <boost/phoenix/core/call.hpp>
  12. #include <boost/phoenix/core/expression.hpp>
  13. #include <boost/phoenix/core/value.hpp>
  14. namespace boost { namespace phoenix
  15. {
  16. /////////////////////////////////////////////////////////////////////////////
  17. //
  18. // null_actor
  19. //
  20. // An actor that does nothing (a "bum", if you will :-).
  21. //
  22. /////////////////////////////////////////////////////////////////////////////
  23. namespace detail
  24. {
  25. struct nothing {};
  26. }
  27. namespace expression
  28. {
  29. struct null
  30. : expression::value<detail::nothing>
  31. {};
  32. }
  33. template<typename Dummy>
  34. struct is_custom_terminal<detail::nothing, Dummy>
  35. : mpl::true_
  36. {};
  37. template<typename Dummy>
  38. struct custom_terminal<detail::nothing, Dummy>
  39. {
  40. typedef void result_type;
  41. template <typename Context>
  42. void operator()(detail::nothing, Context &) const
  43. {
  44. }
  45. };
  46. typedef expression::null::type nothing_type BOOST_ATTRIBUTE_UNUSED;
  47. #ifndef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS
  48. nothing_type const BOOST_ATTRIBUTE_UNUSED nothing = {{{}}};
  49. #endif
  50. }}
  51. #endif