is_value.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*==============================================================================
  2. Copyright (c) 2005-2010 Joel de Guzman
  3. Copyright (c) 2015 John Fletcher
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #ifndef BOOST_PHOENIX_CORE_IS_VALUE_HPP
  8. #define BOOST_PHOENIX_CORE_IS_VALUE_HPP
  9. #include <boost/mpl/bool.hpp>
  10. // Copied from is_actor.hpp
  11. // Note to Thomas and any future maintainer: please make this as
  12. // lightweight as possible (as it is right now).
  13. namespace boost { namespace phoenix
  14. {
  15. ///////////////////////////////////////////////////////////////////////////////
  16. //
  17. // is_value<T>
  18. //
  19. // Tests if T is a value. Evaluates to mpl::true_ or mpl::false_
  20. //
  21. ///////////////////////////////////////////////////////////////////////////////
  22. namespace expression {
  23. template <typename T>
  24. struct value;
  25. }
  26. template <typename T, typename Enable = void>
  27. struct is_value
  28. : mpl::false_
  29. {};
  30. template <typename T>
  31. struct is_value<T const>
  32. : is_value<T>
  33. {};
  34. template <typename T>
  35. struct is_value<T &>
  36. : is_value<T>
  37. {};
  38. // This does not seem to work.
  39. // There is an alternative in value.hpp which does work.
  40. template <typename T>
  41. struct is_value< expression::value<T> >
  42. : mpl::true_
  43. {};
  44. template <typename T>
  45. bool is_val(T const & /* t */)
  46. {
  47. return is_value<T>::value;
  48. }
  49. }}
  50. #endif