forked from OctaForge/libostd
move move/forward to utility.h
This commit is contained in:
parent
97fd88be62
commit
296b7cdeb9
|
@ -9,7 +9,7 @@
|
|||
#include <stddef.h>
|
||||
|
||||
#include "octa/types.h"
|
||||
#include "octa/traits.h"
|
||||
#include "octa/utility.h"
|
||||
|
||||
namespace octa {
|
||||
struct InputRange {};
|
||||
|
|
|
@ -165,28 +165,6 @@ namespace octa {
|
|||
template<typename > struct IsArray : false_t {};
|
||||
template<typename T > struct IsArray<T[] >: true_t {};
|
||||
template<typename T, size_t N> struct IsArray<T[N]>: true_t {};
|
||||
|
||||
/* move */
|
||||
|
||||
template<typename T>
|
||||
static inline constexpr typename RemoveReference<T>::type &&
|
||||
move(T &&v) noexcept {
|
||||
return static_cast<typename RemoveReference<T>::type &&>(v);
|
||||
}
|
||||
|
||||
/* forward */
|
||||
|
||||
template<typename T>
|
||||
static inline constexpr T &&
|
||||
forward(typename RemoveReference<T>::type &v) noexcept {
|
||||
return static_cast<T &&>(v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline constexpr T &&
|
||||
forward(typename RemoveReference<T>::type &&v) noexcept {
|
||||
return static_cast<T &&>(v);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -50,6 +50,24 @@ namespace octa {
|
|||
swap(a[i], b[i]);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline constexpr typename RemoveReference<T>::type &&
|
||||
move(T &&v) noexcept {
|
||||
return static_cast<typename RemoveReference<T>::type &&>(v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline constexpr T &&
|
||||
forward(typename RemoveReference<T>::type &v) noexcept {
|
||||
return static_cast<T &&>(v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline constexpr T &&
|
||||
forward(typename RemoveReference<T>::type &&v) noexcept {
|
||||
return static_cast<T &&>(v);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue