utility_core.hpp
Go to the documentation of this file.
1 //
3 // (C) Copyright Ion Gaztanaga 2012-2012.
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 // See http://www.boost.org/libs/move for documentation.
9 //
11 
16 
17 #ifndef BOOST_MOVE_MOVE_UTILITY_CORE_HPP
18 #define BOOST_MOVE_MOVE_UTILITY_CORE_HPP
19 
20 #ifndef BOOST_CONFIG_HPP
21 # include <boost/config.hpp>
22 #endif
23 #
24 #if defined(BOOST_HAS_PRAGMA_ONCE)
25 # pragma once
26 #endif
27 
29 #include <boost/move/core.hpp>
31 #include <boost/static_assert.hpp>
32 
33 #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
34 
35  namespace boost {
36 
37  template<class T>
38  struct enable_move_utility_emulation
39  {
40  static const bool value = true;
41  };
42 
44  //
45  // move()
46  //
48 
49  template <class T>
50  inline typename ::boost::move_detail::enable_if_c
53  {
54  return x;
55  }
56 
57  template <class T>
58  inline typename ::boost::move_detail::enable_if_c
61  {
62  return *static_cast<rv<T>* >(::boost::move_detail::addressof(x));
63  }
64 
65  template <class T>
66  inline typename ::boost::move_detail::enable_if_c
67  < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value, rv<T>&>::type
68  move(rv<T>& x) BOOST_NOEXCEPT
69  {
70  return x;
71  }
72 
74  //
75  // forward()
76  //
78 
79  template <class T>
80  inline typename ::boost::move_detail::enable_if_c
83  {
84  return const_cast<T&>(x);
85  }
86 
87  template <class T>
88  inline typename ::boost::move_detail::enable_if_c
89  < enable_move_utility_emulation<T>::value && !::boost::move_detail::is_rv<T>::value, const T &>::type
91  {
92  return x;
93  }
94 
96  //
97  // move_if_not_lvalue_reference()
98  //
100 
101  template <class T>
102  inline typename ::boost::move_detail::enable_if_c
104  ::boost::move_detail::is_rv<T>::value
105  , T &>::type
107  {
108  return const_cast<T&>(x);
109  }
110 
111  template <class T>
112  inline typename ::boost::move_detail::enable_if_c
114  !::boost::move_detail::is_rv<T>::value &&
116  !has_move_emulation_enabled<T>::value)
118  >::type
120  {
121  return x;
122  }
123 
124  template <class T>
125  inline typename ::boost::move_detail::enable_if_c
127  !::boost::move_detail::is_rv<T>::value &&
129  has_move_emulation_enabled<T>::value)
130  , rv<T>&
131  >::type
133  {
134  return move(x);
135  }
136 
137  } //namespace boost
138 
139 #else //#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
140 
141  #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
142  #include <utility>
143 
144  namespace boost{
145 
148 
149  } //namespace boost
150 
151  #else
152 
153  namespace boost {
154 
161  template<class T>
163  {
164  static const bool value = false;
165  };
166 
168  //
169  // move
170  //
172 
173  #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
174  template <class T>
179  rvalue_reference move(input_reference) noexcept;
180 
181  #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
182 
183  //Old move approach, lvalues could bind to rvalue references
184  template <class T>
186  { return t; }
187 
188  #else //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
189 
190  template <class T>
193 
194  #endif //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
195 
197  //
198  // forward
199  //
201 
202 
203  #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
204  template <class T> output_reference forward(input_reference) noexcept;
216  #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
217 
218  //Old move approach, lvalues could bind to rvalue references
219 
220  template <class T>
222  { return t; }
223 
224  #else //Old move
225 
226  template <class T>
228  { return static_cast<T&&>(t); }
229 
230  template <class T>
232  {
233  //"boost::forward<T> error: 'T' is a lvalue reference, can't forward as rvalue.";
235  return static_cast<T&&>(t);
236  }
237 
238  #endif //BOOST_MOVE_DOXYGEN_INVOKED
239 
241  //
242  // move_if_not_lvalue_reference
243  //
245 
246 
247  #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
248  template <class T> output_reference move_if_not_lvalue_reference(input_reference) noexcept;
249  #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
250 
251  //Old move approach, lvalues could bind to rvalue references
252 
253  template <class T>
255  { return t; }
256 
257  #else //Old move
258 
259  template <class T>
261  { return static_cast<T&&>(t); }
262 
263  template <class T>
265  {
266  //"boost::forward<T> error: 'T' is a lvalue reference, can't forward as rvalue.";
268  return static_cast<T&&>(t);
269  }
270 
271  #endif //BOOST_MOVE_DOXYGEN_INVOKED
272 
273  } //namespace boost {
274 
275  #endif //#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
276 
277 #endif //BOOST_NO_CXX11_RVALUE_REFERENCES
278 
279 #if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
280 
281 namespace boost{
282 namespace move_detail{
283 
284 template <typename T>
286 
287 } //namespace move_detail{
288 } //namespace boost{
289 
290 #endif //#if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
291 
292 
294 
295 #endif //#ifndef BOOST_MOVE_MOVE_UTILITY_CORE_HPP
BOOST_FORCEINLINE T * addressof(T &v)
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
GLfloat value
T && move_if_not_lvalue_reference(typename::boost::move_detail::remove_reference< T >::type &t) BOOST_NOEXCEPT
GLdouble t
static const bool value
Definition: core.hpp:295
GLdouble x
T && forward(typename::boost::move_detail::remove_reference< T >::type &t) BOOST_NOEXCEPT
add_rvalue_reference< T >::type declval() BOOST_NOEXCEPT
T && forward(typename::boost::move_detail::remove_reference< T >::type &&t) BOOST_NOEXCEPT
#define BOOST_STATIC_ASSERT(...)
#define BOOST_NOEXCEPT
Definition: suffix.hpp:916
GLenum type
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:13