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:
@@ -1,21 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <BAN/Traits.h>
|
||||
|
||||
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>
|
||||
constexpr typename RemoveReference<T>::type&& Move(T&& arg)
|
||||
{
|
||||
|
||||
26
BAN/include/BAN/Traits.h
Normal file
26
BAN/include/BAN/Traits.h
Normal file
@@ -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; } };
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user