Sync changes from upstream repository

This commit is contained in:
Bozo the Builder
2025-11-05 03:40:11 -08:00
parent 85de57f34e
commit f97efd5026
6 changed files with 75 additions and 22 deletions

View File

@@ -380,6 +380,12 @@ public:
*/
void SetArray(T*, int, int);
//Deleted these two functions because the compiler was actually using pointer
//comparison on m_a. Adding implementations for these in Rhino 8 is cumbersome because
//of the template initialization stuff, so use ON_SimpleArray_IsEqual for now.
bool operator==(const ON_SimpleArray<T>& other) const = delete;
bool operator!=(const ON_SimpleArray<T>& other) const = delete;
protected:
// implementation //////////////////////////////////////////////////////
void Move( int /* dest index*/, int /* src index */, int /* element count*/ );
@@ -388,6 +394,24 @@ protected:
int m_capacity; // actual length of m_a[]
};
template <typename T>
bool ON_SimpleArray_IsEqual(const ON_SimpleArray<T>& first, const ON_SimpleArray<T>& second)
{
if (first.Count() != second.Count())
return false;
const int count = first.Count();
for (int i = 0; i < count; i++)
{
//Use operator== because it's more common
if (!(first[i] == second[i]))
return false;
}
return true;
}
////////////////////////////////////////////////////////////////
//
@@ -733,6 +757,14 @@ public:
*/
void SetArray(T*, int, int);
//Deleted these two functions because the compiler was actually using pointer
//comparison on m_a. Adding implementations for these in Rhino 8 is cumbersome because
//of the template initialization stuff, so use ON_ClassArray_IsEqual for now.
bool operator==(const ON_ClassArray<T>& other) const = delete;
bool operator!=(const ON_ClassArray<T>& other) const = delete;
protected:
// implementation //////////////////////////////////////////////////////
void Move( int /* dest index*/, int /* src index */, int /* element count*/ );
@@ -743,6 +775,24 @@ protected:
int m_capacity; // actual length of m_a[]
};
template <typename T>
bool ON_ClassArray_IsEqual(const ON_ClassArray<T>& first, const ON_ClassArray<T>& second)
{
if (first.Count() != second.Count())
return false;
const int count = first.Count();
for (int i = 0; i < count; i++)
{
//Use operator== because it's more common
if (!(first[i] == second[i]))
return false;
}
return true;
}
#if defined(ON_DLL_TEMPLATE)
ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_String>;