/Src/Dependencies/Boost/boost/variant/detail/generic_result_type.hpp

http://hadesmem.googlecode.com/ · C++ Header · 88 lines · 43 code · 19 blank · 26 comment · 0 complexity · dd329f17225237ddadf188f063f20bdf MD5 · raw file

  1. //-----------------------------------------------------------------------------
  2. // boost variant/detail/generic_result_type.hpp header file
  3. // See http://www.boost.org for updates, documentation, and revision history.
  4. //-----------------------------------------------------------------------------
  5. //
  6. // Copyright (c) 2003
  7. // Eric Friedman
  8. //
  9. // Distributed under the Boost Software License, Version 1.0. (See
  10. // accompanying file LICENSE_1_0.txt or copy at
  11. // http://www.boost.org/LICENSE_1_0.txt)
  12. #ifndef BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP
  13. #define BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP
  14. #include "boost/config.hpp"
  15. //////////////////////////////////////////////////////////////////////////
  16. // (workaround) macro BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE
  17. //
  18. // On compilers with BOOST_NO_VOID_RETURNS, this macro provides a route
  19. // to a single syntax for dealing with template functions that may (but
  20. // not necessarily) return nothing (i.e. void).
  21. //
  22. // BOOST_VARIANT_AUX_RETURN_VOID provided for compilers w/ (erroneous?)
  23. // warnings about non-void functions not returning a value.
  24. //
  25. #if !defined(BOOST_NO_VOID_RETURNS)
  26. #define BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) \
  27. T \
  28. /**/
  29. #define BOOST_VARIANT_AUX_RETURN_VOID \
  30. /**/
  31. #define BOOST_VARIANT_AUX_RETURN_VOID_TYPE \
  32. void \
  33. /**/
  34. #else // defined(BOOST_NO_VOID_RETURNS)
  35. namespace boost {
  36. namespace detail { namespace variant {
  37. struct fake_return_void
  38. {
  39. fake_return_void()
  40. {
  41. }
  42. template <typename T>
  43. fake_return_void(const T&)
  44. {
  45. }
  46. };
  47. template <typename T>
  48. struct no_void_returns_helper
  49. {
  50. typedef T type;
  51. };
  52. template <>
  53. struct no_void_returns_helper<void>
  54. {
  55. typedef fake_return_void type;
  56. };
  57. }} // namespace detail::variant
  58. } // namespace boost
  59. #define BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) \
  60. BOOST_DEDUCED_TYPENAME \
  61. ::boost::detail::variant::no_void_returns_helper< T >::type \
  62. /**/
  63. #define BOOST_VARIANT_AUX_RETURN_VOID \
  64. return ::boost::detail::variant::fake_return_void() \
  65. /**/
  66. #define BOOST_VARIANT_AUX_RETURN_VOID_TYPE \
  67. ::boost::detail::variant::fake_return_void
  68. #endif // BOOST_NO_VOID_RETURNS workaround
  69. #endif // BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP