feat(concept): add concepts that depend on templates such as Forward and add corresponding tests

This commit is contained in:
2022-02-04 15:47:57 +08:00
parent 3724188602
commit bafcadc68f
9 changed files with 279 additions and 15 deletions

View File

@ -0,0 +1,23 @@
#pragma once
#include "CoreTypes.h"
#include "Concepts/Common.h"
#include "Templates/Templates.h"
#include "TypeTraits/TypeTraits.h"
NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
template <typename T, typename U>
concept CAssignableFrom =
TIsLValueReference<T>::Value &&
CCommonReferenceWith<const typename TRemoveReference<T>::Type&, const typename TRemoveReference<U>::Type&> &&
requires(T A, U&& B)
{
{ A = Forward<U>(B) } -> CSameAs<T>;
};
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END