feat(templates): add TUnwrapReference and the corresponding testing
This commit is contained in:
parent
e1871de73b
commit
91755d2196
@ -75,6 +75,9 @@ void TestReferenceWrapper()
|
||||
always_check(ArrayA[0] == 2);
|
||||
always_check(ArrayA[1] == 4);
|
||||
always_check(ArrayA[2] == 6);
|
||||
|
||||
always_check((TIsSame<int32, TUnwrapRefDecay<int32>::Type>::Value));
|
||||
always_check((TIsSame<int32&, TUnwrapRefDecay<TReferenceWrapper<int32>>::Type>::Value));
|
||||
}
|
||||
|
||||
void TestOptional()
|
||||
|
@ -40,6 +40,11 @@ private:
|
||||
template <typename T>
|
||||
TReferenceWrapper(T&) -> TReferenceWrapper<T>;
|
||||
|
||||
template <typename T> struct TUnwrapReference { using Type = T; };
|
||||
template <typename T> struct TUnwrapReference<TReferenceWrapper<T>> { using Type = T&; };
|
||||
|
||||
template <typename T> struct TUnwrapRefDecay { using Type = typename TUnwrapReference<typename TDecay<T>::Type>::Type; };
|
||||
|
||||
NAMESPACE_MODULE_END(Utility)
|
||||
NAMESPACE_MODULE_END(Redcraft)
|
||||
NAMESPACE_REDCRAFT_END
|
||||
|
Loading…
Reference in New Issue
Block a user