This commit is contained in:
2025-03-02 04:28:20 +03:30
parent 4602169b1d
commit c9861773ec
9 changed files with 4999 additions and 2024 deletions
+51
View File
@@ -7793,6 +7793,57 @@ int FindIndex(
//
return result;
}
//
// Find Specific Item Index inside a Collection ...
template <typename T>
int FindIndex(
T &item, // Item to Find
const T &items[] // Items for Search
)
{
//
int result = -1;
//
// Check Item Validation ...
if (!item.IsValid())
{
return result;
}
//
int itemsCount = ArraySize(items);
if (itemsCount <= 0)
{
return result;
}
//
for (int i = 0; i < itemsCount; i++)
{
//
T iItem = items[i];
//
// Validate Item ...
if (!iItem.IsValid())
{
continue;
}
//
bool isSame = item.IsSameAs(iItem);
if (isSame && result <= -1)
{
//
result = i;
break;
}
}
//
return result;
}
//
// Check an Array Contains Specified Value ...