unwrap_reference.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. #include <functional>
  17. namespace boost {
  18. template<typename T> class reference_wrapper;
  19. template<typename T> struct unwrap_reference;
  20. namespace numeric {
  21. namespace odeint {
  22. template<typename T>
  23. struct unwrap_reference
  24. {
  25. typedef typename std::remove_reference<T>::type type;
  26. };
  27. template<typename T>
  28. struct unwrap_reference< std::reference_wrapper<T> >
  29. {
  30. typedef typename std::remove_reference<T>::type type;
  31. };
  32. template<typename T>
  33. struct unwrap_reference< boost::reference_wrapper<T> >
  34. {
  35. typedef typename boost::unwrap_reference<T>::type type;
  36. };
  37. namespace detail
  38. {
  39. using ::std::ref;
  40. }
  41. }
  42. }
  43. }
  44. /*
  45. *
  46. * the following is the suggested way, but unfortunately it does not work with all compilers.
  47. */
  48. /*
  49. #include <boost/config.hpp>
  50. #ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
  51. #include <boost/ref.hpp>
  52. #else
  53. #include <functional>
  54. #endif
  55. namespace boost {
  56. namespace numeric {
  57. namespace odeint {
  58. #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
  59. template<typename T>
  60. struct unwrap_reference
  61. {
  62. typedef typename std::remove_reference<T>::type type;
  63. };
  64. template<typename T>
  65. struct unwrap_reference< std::reference_wrapper<T> >
  66. {
  67. typedef typename std::remove_reference<T>::type type;
  68. };
  69. template<typename T>
  70. struct unwrap_reference< boost::reference_wrapper<T> >
  71. {
  72. typedef typename boost::unwrap_reference<T>::type type;
  73. };
  74. #else
  75. using ::boost::unwrap_reference;
  76. #endif
  77. }
  78. }
  79. }
  80. namespace boost {
  81. namespace numeric {
  82. namespace odeint {
  83. namespace detail {
  84. #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
  85. using ::std::ref;
  86. #else
  87. using ::boost::ref;
  88. #endif
  89. }
  90. }
  91. }
  92. }
  93. */
  94. #endif // BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED