forked from Bananymous/banan-os
BAN: Move RemoveReference and IsLValueReference to their own header
Also implement basic Less, Equal, Greater
This commit is contained in:
parent
59fa4055a6
commit
ef2e8f1a2f
|
@ -1,21 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <BAN/Traits.h>
|
||||||
|
|
||||||
namespace BAN
|
namespace BAN
|
||||||
{
|
{
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct RemoveReference { using type = T; };
|
|
||||||
template<typename T>
|
|
||||||
struct RemoveReference<T&> { using type = T; };
|
|
||||||
template<typename T>
|
|
||||||
struct RemoveReference<T&&> { using type = T; };
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct IsLValueReference { static constexpr bool value = false; };
|
|
||||||
template<typename T>
|
|
||||||
struct IsLValueReference<T&> { static constexpr bool value = true; };
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr typename RemoveReference<T>::type&& Move(T&& arg)
|
constexpr typename RemoveReference<T>::type&& Move(T&& arg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace BAN
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct RemoveReference { using type = T; };
|
||||||
|
template<typename T>
|
||||||
|
struct RemoveReference<T&> { using type = T; };
|
||||||
|
template<typename T>
|
||||||
|
struct RemoveReference<T&&> { using type = T; };
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct IsLValueReference { static constexpr bool value = false; };
|
||||||
|
template<typename T>
|
||||||
|
struct IsLValueReference<T&> { static constexpr bool value = true; };
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct Less { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; } };
|
||||||
|
template<typename T>
|
||||||
|
struct Equal { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; } };
|
||||||
|
template<typename T>
|
||||||
|
struct Greater { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs > rhs; } };
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue