1
0

Merging r6383 through r6403 from trunk to ogl-es branch

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6404 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2022-05-15 16:02:08 +00:00
parent ec38b153da
commit ddc14ea87e
57 changed files with 337 additions and 282 deletions

View File

@@ -526,29 +526,31 @@ public:
}
//! Finds an element in linear time, which is very slow.
/** Use binary_search for faster finding. Only works if ==operator is
implemented.
\param element Element to search for.
//! Finds an element by searching linearly from array start to end
/** Can be slow with large arrays, try binary_search for those.
Only works if corresponding operator== is implemented.
\param element Element to search for.
\return Position of the searched element if it was found, otherwise -1
is returned. */
s32 linear_search(const T& element) const
template <class E>
s32 linear_search(const E& element) const
{
for (u32 i=0; i<used; ++i)
if (element == data[i])
if (data[i] == element)
return (s32)i;
return -1;
}
//! Finds an element in linear time, which is very slow.
/** Use binary_search for faster finding. Only works if ==operator is
implemented.
\param element: Element to search for.
//! Finds an element by searching linearly from array end to start.
/** Can be slow with large arrays, try binary_search for those.
Only works if corresponding operator== is implemented.
\param element Element to search for.
\return Position of the searched element if it was found, otherwise -1
is returned. */
s32 linear_reverse_search(const T& element) const
template <class E>
s32 linear_reverse_search(const E& element) const
{
for (s32 i=used-1; i>=0; --i)
if (data[i] == element)