-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmove.hpp
63 lines (47 loc) · 1.39 KB
/
move.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* @file move.hpp
* @brief
* @date 2019-6-2
* @author Peter
* @copyright
* Peter of [ThinkSpirit Laboratory](http://thinkspirit.org/)
* of [Nanjing University of Information Science & Technology](http://www.nuist.edu.cn/)
* all rights reserved
*/
#ifndef KERBAL_COMPATIBILITY_MOVE_HPP
#define KERBAL_COMPATIBILITY_MOVE_HPP
#include <kerbal/compatibility/constexpr.hpp>
#include <kerbal/compatibility/noexcept.hpp>
#include <kerbal/type_traits/remove_reference.hpp>
namespace kerbal
{
namespace compatibility
{
# if __cplusplus < 201103L
template <typename T>
typename kerbal::type_traits::remove_reference<T>::type &
to_xvalue(T & value)
{
return static_cast<typename kerbal::type_traits::remove_reference<T>::type &>(value);
}
# else
template <typename T>
KERBAL_CONSTEXPR
typename kerbal::type_traits::remove_reference<T>::type &&
to_xvalue(T && value) KERBAL_NOEXCEPT
{
return static_cast<typename kerbal::type_traits::remove_reference<T>::type &&>(value);
}
# endif
# if __cplusplus >= 201103L
template <typename T>
KERBAL_CONSTEXPR
typename kerbal::type_traits::remove_reference<T>::type &&
move(T && value) KERBAL_NOEXCEPT
{
return static_cast<typename kerbal::type_traits::remove_reference<T>::type &&>(value);
}
# endif
} // namespace compatibility
} // namespace kerbal
#endif // KERBAL_COMPATIBILITY_MOVE_HPP