/src/contrib/boost/spirit/home/phoenix/core/as_actor.hpp

http://pythonocc.googlecode.com/ · C++ Header · 62 lines · 45 code · 11 blank · 6 comment · 0 complexity · 9db723eea93021a40f6445e51f31ec4f MD5 · raw file

  1. /*=============================================================================
  2. Copyright (c) 2001-2007 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 PHOENIX_CORE_AS_ACTOR_HPP
  7. #define PHOENIX_CORE_AS_ACTOR_HPP
  8. #include <boost/spirit/home/phoenix/core/actor.hpp>
  9. namespace boost { namespace phoenix
  10. {
  11. template <typename T>
  12. struct as_actor_base; // defined in value.hpp
  13. template <typename Base>
  14. struct as_actor_base<actor<Base> >
  15. {
  16. typedef Base type;
  17. static Base const&
  18. convert(actor<Base> const& x)
  19. {
  20. return x;
  21. }
  22. };
  23. template <>
  24. struct as_actor_base<fusion::void_>
  25. {
  26. typedef fusion::void_ type;
  27. struct error_attempting_to_convert_void_type_to_an_actor {};
  28. static void
  29. convert(error_attempting_to_convert_void_type_to_an_actor);
  30. };
  31. template <>
  32. struct as_actor_base<void>
  33. {
  34. typedef void type;
  35. struct error_attempting_to_convert_void_type_to_an_actor {};
  36. static void
  37. convert(error_attempting_to_convert_void_type_to_an_actor);
  38. };
  39. template <typename T>
  40. struct as_actor
  41. {
  42. typedef actor<typename as_actor_base<T>::type> type;
  43. static type
  44. convert(T const& x)
  45. {
  46. return as_actor_base<T>::convert(x);
  47. }
  48. };
  49. }}
  50. #endif