unwrap_reference.hpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/util/unwrap_reference.hpp
  4. [begin_description]
  5. unwrap_reference
  6. [end_description]
  7. Copyright 2012-2013 Karsten Ahnert
  8. Copyright 2012-2013 Mario Mulansky
  9. Distributed under the Boost Software License, Version 1.0.
  10. (See accompanying file LICENSE_1_0.txt or
  11. copy at http://www.boost.org/LICENSE_1_0.txt)
  12. */
  13. #ifndef BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED
  14. #define BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED
  15. #include <boost/numeric/odeint/config.hpp>
  16. #if BOOST_NUMERIC_ODEINT_CXX11
  17. #include <functional>
  18. #else
  19. #include <boost/ref.hpp>
  20. #endif
  21. namespace boost {
  22. #if BOOST_NUMERIC_ODEINT_CXX11
  23. template<typename T> class reference_wrapper;
  24. template<typename T> struct unwrap_reference;
  25. #endif
  26. namespace numeric {
  27. namespace odeint {
  28. #if BOOST_NUMERIC_ODEINT_CXX11
  29. template<typename T>
  30. struct unwrap_reference
  31. {
  32. typedef typename std::remove_reference<T>::type type;
  33. };
  34. template<typename T>
  35. struct unwrap_reference< std::reference_wrapper<T> >
  36. {
  37. typedef typename std::remove_reference<T>::type type;
  38. };
  39. template<typename T>
  40. struct unwrap_reference< boost::reference_wrapper<T> >
  41. {
  42. typedef typename boost::unwrap_reference<T>::type type;
  43. };
  44. #else
  45. using ::boost::unwrap_reference;
  46. #endif
  47. namespace detail
  48. {
  49. #if BOOST_NUMERIC_ODEINT_CXX11
  50. using ::std::ref;
  51. #else
  52. using ::boost::ref;
  53. #endif
  54. }
  55. }
  56. }
  57. }
  58. /*
  59. *
  60. * the following is the suggested way, but unfortunately it does not work with all compilers.
  61. */
  62. /*
  63. #include <boost/config.hpp>
  64. #ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
  65. #include <boost/ref.hpp>
  66. #else
  67. #include <functional>
  68. #endif
  69. namespace boost {
  70. namespace numeric {
  71. namespace odeint {
  72. #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
  73. template<typename T>
  74. struct unwrap_reference
  75. {
  76. typedef typename std::remove_reference<T>::type type;
  77. };
  78. template<typename T>
  79. struct unwrap_reference< std::reference_wrapper<T> >
  80. {
  81. typedef typename std::remove_reference<T>::type type;
  82. };
  83. template<typename T>
  84. struct unwrap_reference< boost::reference_wrapper<T> >
  85. {
  86. typedef typename boost::unwrap_reference<T>::type type;
  87. };
  88. #else
  89. using ::boost::unwrap_reference;
  90. #endif
  91. }
  92. }
  93. }
  94. namespace boost {
  95. namespace numeric {
  96. namespace odeint {
  97. namespace detail {
  98. #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
  99. using ::std::ref;
  100. #else
  101. using ::boost::ref;
  102. #endif
  103. }
  104. }
  105. }
  106. }
  107. */
  108. #endif // BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED