mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-21 13:06:47 +08:00
Update release
This commit is contained in:
@@ -461,6 +461,7 @@ Renderers
|
||||
ColorItemResource selectedFocused;
|
||||
ColorItemResource selectedUnfocused;
|
||||
|
||||
std::partial_ordering operator<=>(const ColorEntryResource&) const { return std::partial_ordering::unordered; }
|
||||
bool operator==(const ColorEntryResource& value) const { return false; }
|
||||
};
|
||||
|
||||
@@ -1687,8 +1688,8 @@ Renderers
|
||||
ColorItemResource selectedFocused;
|
||||
ColorItemResource selectedUnfocused;
|
||||
|
||||
std::partial_ordering operator<=>(const ColorEntryResource&) const { return std::partial_ordering::unordered; }
|
||||
bool operator==(const ColorEntryResource& value){return false;}
|
||||
bool operator!=(const ColorEntryResource& value){return true;}
|
||||
};
|
||||
|
||||
typedef collections::Array<ColorEntryResource> ColorArray;
|
||||
|
||||
@@ -15259,11 +15259,6 @@ TextItem
|
||||
{
|
||||
}
|
||||
|
||||
bool TextItem::operator==(const TextItem& value)const
|
||||
{
|
||||
return text == value.text;
|
||||
}
|
||||
|
||||
const WString& TextItem::GetText()
|
||||
{
|
||||
return text;
|
||||
|
||||
+16
-12
@@ -74,8 +74,7 @@ Enumerations
|
||||
};
|
||||
|
||||
#define GUI_DEFINE_COMPARE_OPERATORS(TYPE)\
|
||||
std::strong_ordering operator<=>(const TYPE&) const = default;\
|
||||
bool operator==(const TYPE&) const = default;\
|
||||
auto operator<=>(const TYPE&) const = default;\
|
||||
|
||||
/***********************************************************************
|
||||
TextPos
|
||||
@@ -1581,8 +1580,7 @@ INativeWindow
|
||||
BoolOption TitleBarOption = BoolOption::Customizable;
|
||||
BoolOption CustomFrameEnabled = BoolOption::Customizable;
|
||||
|
||||
std::strong_ordering operator<=>(const NativeWindowFrameConfig&) const = default;
|
||||
bool operator==(const NativeWindowFrameConfig&) const = default;
|
||||
auto operator<=>(const NativeWindowFrameConfig&) const = default;
|
||||
|
||||
static const NativeWindowFrameConfig Default;
|
||||
};
|
||||
@@ -5109,7 +5107,7 @@ Flow Compositions
|
||||
/// <summary>The distance value.</summary>
|
||||
vint distance = 0;
|
||||
|
||||
bool operator==(const GuiFlowOption& value) const = default;
|
||||
GUI_DEFINE_COMPARE_OPERATORS(GuiFlowOption)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -5936,7 +5934,7 @@ Table Compositions
|
||||
{
|
||||
}
|
||||
|
||||
bool operator==(const GuiCellOption& value) const = default;
|
||||
GUI_DEFINE_COMPARE_OPERATORS(GuiCellOption)
|
||||
|
||||
/// <summary>Creates an absolute sizing option</summary>
|
||||
/// <returns>The created option.</returns>
|
||||
@@ -6492,13 +6490,15 @@ Helpers
|
||||
{\
|
||||
TVALUE resource;\
|
||||
vint counter;\
|
||||
bool operator==(const Package& package)const{return false;}\
|
||||
std::partial_ordering operator<=>(const Package&) const { return std::partial_ordering::unordered; }\
|
||||
bool operator==(const Package&)const{return false;}\
|
||||
};\
|
||||
struct DeadPackage\
|
||||
{\
|
||||
TKEY key;\
|
||||
TVALUE value;\
|
||||
bool operator==(const DeadPackage& package)const{return false;}\
|
||||
std::partial_ordering operator<=>(const DeadPackage&) const { return std::partial_ordering::unordered; }\
|
||||
bool operator==(const DeadPackage&)const{return false;}\
|
||||
};\
|
||||
Dictionary<TKEY, Package> aliveResources;\
|
||||
List<DeadPackage> deadResources;\
|
||||
@@ -10540,8 +10540,7 @@ Rich Content Document (style)
|
||||
static DocumentFontSize Parse(const WString& value);
|
||||
WString ToString()const;
|
||||
|
||||
std::partial_ordering operator<=>(const DocumentFontSize&) const = default;
|
||||
bool operator==(const DocumentFontSize&) const = default;
|
||||
auto operator<=>(const DocumentFontSize&) const = default;
|
||||
};
|
||||
|
||||
/// <summary>Represents a text style.</summary>
|
||||
@@ -10922,7 +10921,7 @@ Elements
|
||||
int radiusX = 0;
|
||||
int radiusY = 0;
|
||||
|
||||
bool operator==(const ElementShape& value) const = default;
|
||||
GUI_DEFINE_COMPARE_OPERATORS(ElementShape)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -11914,6 +11913,8 @@ Colorized Plain Text (model)
|
||||
~TextLine();
|
||||
|
||||
static vint CalculateBufferLength(vint dataLength);
|
||||
|
||||
std::partial_ordering operator<=>(const TextLine&) const { return std::partial_ordering::unordered; }
|
||||
bool operator==(const TextLine& value) const { return false; }
|
||||
|
||||
/// <summary>
|
||||
@@ -14279,7 +14280,8 @@ TextItemProvider
|
||||
TextItem(const WString& _text, bool _checked=false);
|
||||
~TextItem();
|
||||
|
||||
bool operator==(const TextItem& value)const;
|
||||
std::strong_ordering operator<=>(const TextItem& value) const { return text <=> value.text; }
|
||||
bool operator==(const TextItem& value) const { return text == value.text; }
|
||||
|
||||
/// <summary>Get the text of this item.</summary>
|
||||
/// <returns>The text of this item.</returns>
|
||||
@@ -21684,6 +21686,8 @@ namespace vl
|
||||
vint column = 0;
|
||||
vint rowSpan = 1;
|
||||
vint columnSpan = 1;
|
||||
|
||||
auto operator<=>(const SiteValue&) const = default;
|
||||
};
|
||||
|
||||
class LocalizedStrings
|
||||
|
||||
+24
-10
@@ -947,6 +947,7 @@ namespace vl
|
||||
char* endptr = 0;
|
||||
vint result = strtol(string.Buffer(), &endptr, 10);
|
||||
success = endptr == string.Buffer() + string.Length() && itoa(result) == string;
|
||||
if (success) success &= (_I32_MIN <= result && result <= _I32_MAX);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -955,6 +956,7 @@ namespace vl
|
||||
wchar_t* endptr = 0;
|
||||
vint result = wcstol(string.Buffer(), &endptr, 10);
|
||||
success = endptr == string.Buffer() + string.Length() && itow(result) == string;
|
||||
if (success) success &= (_I32_MIN <= result && result <= _I32_MAX);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -979,6 +981,7 @@ namespace vl
|
||||
char* endptr = 0;
|
||||
vuint result = strtoul(string.Buffer(), &endptr, 10);
|
||||
success = endptr == string.Buffer() + string.Length() && utoa(result) == string;
|
||||
if (success) success &= (result <= _UI32_MAX);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -987,6 +990,7 @@ namespace vl
|
||||
wchar_t* endptr = 0;
|
||||
vuint result = wcstoul(string.Buffer(), &endptr, 10);
|
||||
success = endptr == string.Buffer() + string.Length() && utow(result) == string;
|
||||
if (success) success &= (result <= _UI32_MAX);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1025,61 +1029,71 @@ namespace vl
|
||||
vint atoi(const AString& string)
|
||||
{
|
||||
bool success = false;
|
||||
return atoi_test(string, success);
|
||||
vint result = atoi_test(string, success);
|
||||
return success ? result : 0;
|
||||
}
|
||||
|
||||
vint wtoi(const WString& string)
|
||||
{
|
||||
bool success = false;
|
||||
return wtoi_test(string, success);
|
||||
vint result = wtoi_test(string, success);
|
||||
return success ? result : 0;
|
||||
}
|
||||
|
||||
vint64_t atoi64(const AString& string)
|
||||
{
|
||||
bool success = false;
|
||||
return atoi64_test(string, success);
|
||||
vint64_t result = atoi64_test(string, success);
|
||||
return success ? result : 0;
|
||||
}
|
||||
|
||||
vint64_t wtoi64(const WString& string)
|
||||
{
|
||||
bool success = false;
|
||||
return wtoi64_test(string, success);
|
||||
vint64_t result = wtoi64_test(string, success);
|
||||
return success ? result : 0;
|
||||
}
|
||||
|
||||
vuint atou(const AString& string)
|
||||
{
|
||||
bool success = false;
|
||||
return atou_test(string, success);
|
||||
vuint result = atou_test(string, success);
|
||||
return success ? result : 0;
|
||||
}
|
||||
|
||||
vuint wtou(const WString& string)
|
||||
{
|
||||
bool success = false;
|
||||
return wtou_test(string, success);
|
||||
vuint result = wtou_test(string, success);
|
||||
return success ? result : 0;
|
||||
}
|
||||
|
||||
vuint64_t atou64(const AString& string)
|
||||
{
|
||||
bool success = false;
|
||||
return atou64_test(string, success);
|
||||
vuint64_t result = atou64_test(string, success);
|
||||
return success ? result : 0;
|
||||
}
|
||||
|
||||
vuint64_t wtou64(const WString& string)
|
||||
{
|
||||
bool success = false;
|
||||
return wtou64_test(string, success);
|
||||
vuint64_t result = wtou64_test(string, success);
|
||||
return success ? result : 0;
|
||||
}
|
||||
|
||||
double atof(const AString& string)
|
||||
{
|
||||
bool success = false;
|
||||
return atof_test(string, success);
|
||||
double result = atof_test(string, success);
|
||||
return success ? result : 0;
|
||||
}
|
||||
|
||||
double wtof(const WString& string)
|
||||
{
|
||||
bool success = false;
|
||||
return wtof_test(string, success);
|
||||
double result = wtof_test(string, success);
|
||||
return success ? result : 0;
|
||||
}
|
||||
|
||||
AString itoa(vint number)
|
||||
|
||||
+1245
-1056
File diff suppressed because it is too large
Load Diff
+13
-2
@@ -154,10 +154,21 @@ ParsingTextRange
|
||||
{
|
||||
}
|
||||
|
||||
bool operator==(const ParsingTextRange& range)const { return start == range.start && end == range.end; }
|
||||
bool operator!=(const ParsingTextRange& range)const { return start != range.start || end != range.end; }
|
||||
bool Contains(const ParsingTextPos& pos)const { return start <= pos && pos <= end; }
|
||||
bool Contains(const ParsingTextRange& range)const { return start <= range.start && range.end <= end; }
|
||||
|
||||
friend std::strong_ordering operator<=>(const ParsingTextRange& a, const ParsingTextRange& b)
|
||||
{
|
||||
std::strong_ordering
|
||||
result = a.start <=> b.start; if (result != 0) return result;
|
||||
result = a.end <=> b.end; if (result != 0) return result;
|
||||
return std::strong_ordering::equal;
|
||||
}
|
||||
|
||||
friend bool operator==(const ParsingTextRange& a, const ParsingTextRange& b)
|
||||
{
|
||||
return (a <=> b) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
|
||||
+1
-50
@@ -1085,7 +1085,7 @@ EventObject
|
||||
volatile bool signaled;
|
||||
CriticalSection mutex;
|
||||
ConditionVariable cond;
|
||||
volatile vint counter = 0;
|
||||
atomic_vint counter = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1503,55 +1503,6 @@ ConditionVariable
|
||||
pthread_cond_broadcast(&internalData->cond);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
SpinLock
|
||||
***********************************************************************/
|
||||
|
||||
SpinLock::Scope::Scope(SpinLock& _spinLock)
|
||||
:spinLock(&_spinLock)
|
||||
{
|
||||
spinLock->Enter();
|
||||
}
|
||||
|
||||
SpinLock::Scope::~Scope()
|
||||
{
|
||||
spinLock->Leave();
|
||||
}
|
||||
|
||||
SpinLock::SpinLock()
|
||||
:token(0)
|
||||
{
|
||||
}
|
||||
|
||||
SpinLock::~SpinLock()
|
||||
{
|
||||
}
|
||||
|
||||
bool SpinLock::TryEnter()
|
||||
{
|
||||
return __sync_lock_test_and_set(&token, 1)==0;
|
||||
}
|
||||
|
||||
void SpinLock::Enter()
|
||||
{
|
||||
while(__sync_val_compare_and_swap(&token, 0, 1)!=0)
|
||||
{
|
||||
while (token != 0)
|
||||
{
|
||||
#ifdef VCZH_ARM
|
||||
__yield();
|
||||
#else
|
||||
_mm_pause();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SpinLock::Leave()
|
||||
{
|
||||
__sync_lock_test_and_set(&token, 0);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
ThreadLocalStorage
|
||||
***********************************************************************/
|
||||
|
||||
@@ -1710,55 +1710,6 @@ ConditionVariable
|
||||
WakeAllConditionVariable(&internalData->variable);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
SpinLock
|
||||
***********************************************************************/
|
||||
|
||||
SpinLock::Scope::Scope(SpinLock& _spinLock)
|
||||
:spinLock(&_spinLock)
|
||||
{
|
||||
spinLock->Enter();
|
||||
}
|
||||
|
||||
SpinLock::Scope::~Scope()
|
||||
{
|
||||
spinLock->Leave();
|
||||
}
|
||||
|
||||
SpinLock::SpinLock()
|
||||
:token(0)
|
||||
{
|
||||
}
|
||||
|
||||
SpinLock::~SpinLock()
|
||||
{
|
||||
}
|
||||
|
||||
bool SpinLock::TryEnter()
|
||||
{
|
||||
return _InterlockedExchange(&token, 1)==0;
|
||||
}
|
||||
|
||||
void SpinLock::Enter()
|
||||
{
|
||||
while(_InterlockedCompareExchange(&token, 1, 0)!=0)
|
||||
{
|
||||
while (token != 0)
|
||||
{
|
||||
#ifdef VCZH_ARM
|
||||
__yield();
|
||||
#else
|
||||
_mm_pause();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SpinLock::Leave()
|
||||
{
|
||||
_InterlockedExchange(&token, 0);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
ThreadLocalStorage
|
||||
***********************************************************************/
|
||||
|
||||
@@ -460,8 +460,59 @@ Licensed under https://github.com/vczh-libraries/License
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
#if defined VCZH_ARM
|
||||
#elif defined VCZH_MSVC || defined VCZH_GCC
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
namespace vl
|
||||
{
|
||||
|
||||
/***********************************************************************
|
||||
SpinLock
|
||||
***********************************************************************/
|
||||
|
||||
SpinLock::Scope::Scope(SpinLock& _spinLock)
|
||||
:spinLock(&_spinLock)
|
||||
{
|
||||
spinLock->Enter();
|
||||
}
|
||||
|
||||
SpinLock::Scope::~Scope()
|
||||
{
|
||||
spinLock->Leave();
|
||||
}
|
||||
|
||||
bool SpinLock::TryEnter()
|
||||
{
|
||||
return token.exchange(1) == 0;
|
||||
}
|
||||
|
||||
void SpinLock::Enter()
|
||||
{
|
||||
vint expected = 0;
|
||||
while (!token.compare_exchange_strong(expected, 1))
|
||||
{
|
||||
while (token != 0)
|
||||
{
|
||||
#ifdef VCZH_ARM
|
||||
__yield();
|
||||
#else
|
||||
_mm_pause();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SpinLock::Leave()
|
||||
{
|
||||
token.exchange(0);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
ThreadLocalStorage
|
||||
***********************************************************************/
|
||||
|
||||
void ThreadLocalStorage::Clear()
|
||||
{
|
||||
CHECK_ERROR(!disposed, L"vl::ThreadLocalStorage::Clear()#Cannot access a disposed ThreadLocalStorage.");
|
||||
|
||||
+3
-5
@@ -865,8 +865,6 @@ Kernel Mode Objects in Process
|
||||
/***********************************************************************
|
||||
User Mode Objects
|
||||
***********************************************************************/
|
||||
|
||||
typedef long LockedInt;
|
||||
|
||||
/// <summary>
|
||||
/// Spin lock. It is similar to mutex, but it does not occupy resource in the system.
|
||||
@@ -881,12 +879,12 @@ User Mode Objects
|
||||
class SpinLock : public Object
|
||||
{
|
||||
protected:
|
||||
volatile LockedInt token;
|
||||
atomic_vint token = 0;
|
||||
public:
|
||||
NOT_COPYABLE(SpinLock);
|
||||
/// <summary>Create a spin lock.</summary>
|
||||
SpinLock();
|
||||
~SpinLock();
|
||||
SpinLock() = default;
|
||||
~SpinLock() = default;
|
||||
|
||||
/// <summary>Try enter a spin lock. This function will return immediately.</summary>
|
||||
/// <returns>Returns true if the current thread owned the spin lock.</returns>
|
||||
|
||||
+24
-24
@@ -128,8 +128,8 @@ Location
|
||||
ParsingTextRange()
|
||||
:codeIndex(-1)
|
||||
{
|
||||
end.index=-1;
|
||||
end.column=-1;
|
||||
end.index = -1;
|
||||
end.column = -1;
|
||||
}
|
||||
|
||||
ParsingTextRange(const ParsingTextPos& _start, const ParsingTextPos& _end, vint _codeIndex = -1)
|
||||
@@ -142,18 +142,29 @@ Location
|
||||
ParsingTextRange(const regex::RegexToken* startToken, const regex::RegexToken* endToken)
|
||||
:codeIndex(startToken->codeIndex)
|
||||
{
|
||||
start.index=startToken->start;
|
||||
start.row=startToken->rowStart;
|
||||
start.column=startToken->columnStart;
|
||||
end.index=endToken->start+endToken->length-1;
|
||||
end.row=endToken->rowEnd;
|
||||
end.column=endToken->columnEnd;
|
||||
start.index = startToken->start;
|
||||
start.row = startToken->rowStart;
|
||||
start.column = startToken->columnStart;
|
||||
end.index = endToken->start + endToken->length - 1;
|
||||
end.row = endToken->rowEnd;
|
||||
end.column = endToken->columnEnd;
|
||||
}
|
||||
|
||||
bool operator==(const ParsingTextRange& range)const{return start==range.start && end==range.end;}
|
||||
bool operator!=(const ParsingTextRange& range)const{return start!=range.start || end!=range.end;}
|
||||
bool Contains(const ParsingTextPos& pos)const{return start<=pos && pos<=end;}
|
||||
bool Contains(const ParsingTextRange& range)const{return start<=range.start && range.end<=end;}
|
||||
bool Contains(const ParsingTextPos& pos)const { return start <= pos && pos <= end; }
|
||||
bool Contains(const ParsingTextRange& range)const { return start <= range.start && range.end <= end; }
|
||||
|
||||
friend std::strong_ordering operator<=>(const ParsingTextRange& a, const ParsingTextRange& b)
|
||||
{
|
||||
std::strong_ordering
|
||||
result = a.start <=> b.start; if (result != 0) return result;
|
||||
result = a.end <=> b.end; if (result != 0) return result;
|
||||
return std::strong_ordering::equal;
|
||||
}
|
||||
|
||||
friend bool operator==(const ParsingTextRange& a, const ParsingTextRange& b)
|
||||
{
|
||||
return (a <=> b) == 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1122,18 +1133,7 @@ DefinitionTypeScopePair
|
||||
{
|
||||
}
|
||||
|
||||
std::strong_ordering operator<=>(const DefinitionTypeScopePair& pair)const
|
||||
{
|
||||
std::strong_ordering
|
||||
result = type <=> pair.type; if (result != 0) return result;
|
||||
result = scope <=> pair.scope; if (result != 0) return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool operator==(const DefinitionTypeScopePair& pair)const
|
||||
{
|
||||
return (*this <=> pair) == 0;
|
||||
}
|
||||
auto operator<=>(const DefinitionTypeScopePair&) const = default;
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
|
||||
+21
-42
@@ -107,7 +107,7 @@ DescriptableObject
|
||||
typedef collections::Dictionary<WString, Ptr<Object>> InternalPropertyMap;
|
||||
typedef bool(*DestructorProc)(DescriptableObject* obj, bool forceDisposing);
|
||||
private:
|
||||
volatile vint referenceCounter;
|
||||
atomic_vint referenceCounter;
|
||||
|
||||
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
|
||||
size_t objectSize;
|
||||
@@ -181,6 +181,12 @@ DescriptableObject
|
||||
DescriptableObject();
|
||||
virtual ~DescriptableObject();
|
||||
|
||||
// all fields are describing the object, it would be incorrect if they are copied from one to another.
|
||||
DescriptableObject(const DescriptableObject&) : DescriptableObject() {}
|
||||
DescriptableObject(DescriptableObject&&) : DescriptableObject() {}
|
||||
DescriptableObject& operator=(const DescriptableObject&) { return *this; }
|
||||
DescriptableObject& operator=(DescriptableObject&&) { return *this; }
|
||||
|
||||
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
|
||||
/// <summary>
|
||||
/// <p>Get the type descriptor that describe the real type of this object.</p>
|
||||
@@ -680,7 +686,7 @@ ReferenceCounterOperator
|
||||
template<typename T>
|
||||
struct ReferenceCounterOperator<T, std::enable_if_t<std::is_convertible_v<T*, reflection::DescriptableObject*>>>
|
||||
{
|
||||
static __forceinline volatile vint* CreateCounter(T* reference)
|
||||
static __forceinline atomic_vint* CreateCounter(T* reference)
|
||||
{
|
||||
reflection::DescriptableObject* obj=reference;
|
||||
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
|
||||
@@ -695,7 +701,7 @@ ReferenceCounterOperator
|
||||
return &obj->referenceCounter;
|
||||
}
|
||||
|
||||
static __forceinline void DeleteReference(volatile vint* counter, void* reference)
|
||||
static __forceinline void DeleteReference(atomic_vint* counter, void* reference)
|
||||
{
|
||||
reflection::DescriptableObject* obj=(T*)reference;
|
||||
obj->Dispose(false);
|
||||
@@ -1968,21 +1974,14 @@ ValueType
|
||||
{
|
||||
if (auto typedBox = boxedValue.Cast<TypedBox<T>>())
|
||||
{
|
||||
if constexpr (std::three_way_comparable<T, std::strong_ordering>)
|
||||
auto r = value <=> typedBox->value;
|
||||
if constexpr (std::is_same_v<decltype(r), std::partial_ordering>)
|
||||
{
|
||||
auto r = value <=> typedBox->value;
|
||||
if (r < 0) return IBoxedValue::Smaller;
|
||||
if (r > 0) return IBoxedValue::Greater;
|
||||
return IBoxedValue::Equal;
|
||||
}
|
||||
else if constexpr (std::three_way_comparable<T, std::partial_ordering>)
|
||||
{
|
||||
auto r = value <=> typedBox->value;
|
||||
if (r == std::partial_ordering::unordered) return IBoxedValue::NotComparable;
|
||||
if (r < 0) return IBoxedValue::Smaller;
|
||||
if (r > 0) return IBoxedValue::Greater;
|
||||
return IBoxedValue::Equal;
|
||||
}
|
||||
if (r < 0) return IBoxedValue::Smaller;
|
||||
if (r > 0) return IBoxedValue::Greater;
|
||||
return IBoxedValue::Equal;
|
||||
}
|
||||
return IBoxedValue::NotComparable;
|
||||
}
|
||||
@@ -7269,40 +7268,20 @@ namespace vl
|
||||
|
||||
vint data[4];
|
||||
|
||||
static inline vint Compare(const MethodPointerBinaryData& a, const MethodPointerBinaryData& b)
|
||||
friend std::strong_ordering operator<=>(const MethodPointerBinaryData& a, const MethodPointerBinaryData& b)
|
||||
{
|
||||
for (vint i = 0; i < sizeof(data) / sizeof(*data); i++)
|
||||
{
|
||||
auto result = a.data[0] - b.data[0];
|
||||
auto result = a.data[i] <=> b.data[i];
|
||||
if (result != 0) return result;
|
||||
}
|
||||
{
|
||||
auto result = a.data[1] - b.data[1];
|
||||
if (result != 0) return result;
|
||||
}
|
||||
{
|
||||
auto result = a.data[2] - b.data[2];
|
||||
if (result != 0) return result;
|
||||
}
|
||||
{
|
||||
auto result = a.data[3] - b.data[3];
|
||||
if (result != 0) return result;
|
||||
}
|
||||
return 0;
|
||||
return std::strong_ordering::equal;
|
||||
}
|
||||
|
||||
#define COMPARE(OPERATOR)\
|
||||
inline bool operator OPERATOR(const MethodPointerBinaryData& d)const\
|
||||
{\
|
||||
return Compare(*this, d) OPERATOR 0;\
|
||||
friend bool operator==(const MethodPointerBinaryData& a, const MethodPointerBinaryData& b)
|
||||
{
|
||||
return (a <=> b) == 0;
|
||||
}
|
||||
|
||||
COMPARE(<)
|
||||
COMPARE(<=)
|
||||
COMPARE(>)
|
||||
COMPARE(>=)
|
||||
COMPARE(==)
|
||||
COMPARE(!=)
|
||||
#undef COMPARE
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
||||
+4
-4
@@ -1387,11 +1387,11 @@ CharRange
|
||||
return begin == cr.begin && end == cr.end;
|
||||
}
|
||||
|
||||
std::strong_ordering operator<=>(char32_t item)const
|
||||
std::weak_ordering operator<=>(char32_t item)const
|
||||
{
|
||||
if (end < item) return std::strong_ordering::less;
|
||||
if (begin > item) return std::strong_ordering::greater;
|
||||
return std::strong_ordering::equal;
|
||||
if (end < item) return std::weak_ordering::less;
|
||||
if (begin > item) return std::weak_ordering::greater;
|
||||
return std::weak_ordering::equivalent;
|
||||
}
|
||||
|
||||
bool operator==(char32_t item)const
|
||||
|
||||
@@ -23422,8 +23422,7 @@ namespace vl
|
||||
{
|
||||
writer.WriteLine(L"");
|
||||
}
|
||||
writer.WriteLine(prefix + L"\tstd::strong_ordering operator<=>(const " + name + L"&) const = default;");
|
||||
writer.WriteLine(prefix + L"\tbool operator==(const " + name + L"&) const = default;");
|
||||
writer.WriteLine(prefix + L"\tauto operator<=>(const " + name + L"&) const = default;");
|
||||
writer.WriteLine(prefix + L"};");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -5681,12 +5681,12 @@ WfStructInstance
|
||||
}
|
||||
|
||||
auto result = af <=> bf;
|
||||
if (result < 0) return IBoxedValue::Smaller;
|
||||
if (result > 0) return IBoxedValue::Greater;
|
||||
if constexpr (std::is_same_v<decltype(result), std::partial_ordering>)
|
||||
{
|
||||
if (result == std::partial_ordering::unordered) return IBoxedValue::NotComparable;
|
||||
}
|
||||
if (result < 0) return IBoxedValue::Smaller;
|
||||
if (result > 0) return IBoxedValue::Greater;
|
||||
|
||||
if (p == ap) ai++;
|
||||
if (p == bp) bi++;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user