[arrays] Update ArrayOf.lsearch()

Currently unused apparently
This commit is contained in:
Behdad Esfahbod 2018-11-24 00:58:44 -05:00
parent 22e1857b01
commit 3e26c8d2b1
1 changed files with 13 additions and 4 deletions

View File

@ -545,14 +545,23 @@ struct ArrayOf
return_trace (true); return_trace (true);
} }
template <typename SearchType> template <typename T>
inline int lsearch (const SearchType &x) const inline Type &lsearch (const T &x)
{ {
unsigned int count = len; unsigned int count = len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (!this->arrayZ[i].cmp (x)) if (!this->arrayZ[i].cmp (x))
return i; return this->arrayZ[i];
return -1; return Crap (T);
}
template <typename T>
inline const Type &lsearch (const T &x) const
{
unsigned int count = len;
for (unsigned int i = 0; i < count; i++)
if (!this->arrayZ[i].cmp (x))
return this->arrayZ[i];
return Null (T);
} }
inline void qsort (void) inline void qsort (void)