1 /* 2 [auto_generated] 3 boost/numeric/odeint/util/unwrap_reference.hpp 4 5 [begin_description] 6 unwrap_reference 7 [end_description] 8 9 Copyright 2012-2013 Karsten Ahnert 10 Copyright 2012-2013 Mario Mulansky 11 12 Distributed under the Boost Software License, Version 1.0. 13 (See accompanying file LICENSE_1_0.txt or 14 copy at http://www.boost.org/LICENSE_1_0.txt) 15 */ 16 17 18 #ifndef BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED 19 #define BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED 20 21 22 #include <boost/numeric/odeint/config.hpp> 23 24 25 #if BOOST_NUMERIC_ODEINT_CXX11 26 #include <functional> 27 #else 28 #include <boost/ref.hpp> 29 #endif 30 31 namespace boost { 32 33 #if BOOST_NUMERIC_ODEINT_CXX11 34 template<typename T> class reference_wrapper; 35 36 template<typename T> struct unwrap_reference; 37 #endif 38 39 namespace numeric { 40 namespace odeint { 41 42 43 #if BOOST_NUMERIC_ODEINT_CXX11 44 45 template<typename T> 46 struct unwrap_reference 47 { 48 typedef typename std::remove_reference<T>::type type; 49 }; 50 51 template<typename T> 52 struct unwrap_reference< std::reference_wrapper<T> > 53 { 54 typedef typename std::remove_reference<T>::type type; 55 }; 56 57 template<typename T> 58 struct unwrap_reference< boost::reference_wrapper<T> > 59 { 60 typedef typename boost::unwrap_reference<T>::type type; 61 }; 62 63 #else 64 65 using ::boost::unwrap_reference; 66 67 #endif 68 69 namespace detail 70 { 71 72 #if BOOST_NUMERIC_ODEINT_CXX11 73 74 using ::std::ref; 75 76 #else 77 78 using ::boost::ref; 79 80 #endif 81 } 82 83 } 84 } 85 } 86 87 88 89 /* 90 * 91 * the following is the suggested way, but unfortunately it does not work with all compilers. 92 */ 93 94 /* 95 96 #include <boost/config.hpp> 97 98 99 #ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL 100 #include <boost/ref.hpp> 101 #else 102 #include <functional> 103 #endif 104 105 106 107 namespace boost { 108 namespace numeric { 109 namespace odeint { 110 111 112 #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL 113 114 template<typename T> 115 struct unwrap_reference 116 { 117 typedef typename std::remove_reference<T>::type type; 118 }; 119 120 template<typename T> 121 struct unwrap_reference< std::reference_wrapper<T> > 122 { 123 typedef typename std::remove_reference<T>::type type; 124 }; 125 126 template<typename T> 127 struct unwrap_reference< boost::reference_wrapper<T> > 128 { 129 typedef typename boost::unwrap_reference<T>::type type; 130 }; 131 132 #else 133 134 using ::boost::unwrap_reference; 135 136 #endif 137 138 } 139 } 140 } 141 142 namespace boost { 143 namespace numeric { 144 namespace odeint { 145 namespace detail { 146 147 148 #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL 149 150 using ::std::ref; 151 152 #else 153 154 using ::boost::ref; 155 156 #endif 157 158 159 } 160 } 161 } 162 } 163 164 */ 165 166 #endif // BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED 167