[vector] Remove old find() method

This commit is contained in:
Behdad Esfahbod 2022-01-19 11:14:25 -07:00
parent 849e40b4db
commit cd9799784c
3 changed files with 12 additions and 23 deletions

View File

@ -447,23 +447,29 @@ struct
private: private:
template <typename T1, typename T2> auto template <typename T1, typename T2> auto
impl (T1&& v1, T2 &&v2, hb_priority<2>) const HB_AUTO_RETURN impl (T1&& v1, T2 &&v2, hb_priority<3>) const HB_AUTO_RETURN
( (
std::forward<T2> (v2).cmp (std::forward<T1> (v1)) == 0 std::forward<T2> (v2).cmp (std::forward<T1> (v1)) == 0
) )
template <typename T1, typename T2> auto template <typename T1, typename T2> auto
impl (T1&& v1, T2 &&v2, hb_priority<1>) const HB_AUTO_RETURN impl (T1&& v1, T2 &&v2, hb_priority<2>) const HB_AUTO_RETURN
( (
std::forward<T1> (v1).cmp (std::forward<T2> (v2)) == 0 std::forward<T1> (v1).cmp (std::forward<T2> (v2)) == 0
) )
template <typename T1, typename T2> auto template <typename T1, typename T2> auto
impl (T1&& v1, T2 &&v2, hb_priority<0>) const HB_AUTO_RETURN impl (T1&& v1, T2 &&v2, hb_priority<1>) const HB_AUTO_RETURN
( (
std::forward<T1> (v1) == std::forward<T2> (v2) std::forward<T1> (v1) == std::forward<T2> (v2)
) )
template <typename T1, typename T2> auto
impl (T1&& v1, T2 &&v2, hb_priority<0>) const HB_AUTO_RETURN
(
std::forward<T2> (v2) == std::forward<T1> (v1)
)
public: public:
template <typename T1, typename T2> auto template <typename T1, typename T2> auto

View File

@ -53,7 +53,7 @@ struct hb_lockable_set_t
item_t *replace_or_insert (T v, lock_t &l, bool replace) item_t *replace_or_insert (T v, lock_t &l, bool replace)
{ {
l.lock (); l.lock ();
item_t *item = items.find (v); item_t *item = items.lsearch (v);
if (item) { if (item) {
if (replace) { if (replace) {
item_t old = *item; item_t old = *item;
@ -76,7 +76,7 @@ struct hb_lockable_set_t
void remove (T v, lock_t &l) void remove (T v, lock_t &l)
{ {
l.lock (); l.lock ();
item_t *item = items.find (v); item_t *item = items.lsearch (v);
if (item) if (item)
{ {
item_t old = *item; item_t old = *item;
@ -93,7 +93,7 @@ struct hb_lockable_set_t
bool find (T v, item_t *i, lock_t &l) bool find (T v, item_t *i, lock_t &l)
{ {
l.lock (); l.lock ();
item_t *item = items.find (v); item_t *item = items.lsearch (v);
if (item) if (item)
*i = *item; *i = *item;
l.unlock (); l.unlock ();

View File

@ -362,23 +362,6 @@ struct hb_vector_t
shrink_vector (size); shrink_vector (size);
} }
template <typename T>
Type *find (T v)
{
for (unsigned int i = 0; i < length; i++)
if (arrayZ[i] == v)
return &arrayZ[i];
return nullptr;
}
template <typename T>
const Type *find (T v) const
{
for (unsigned int i = 0; i < length; i++)
if (arrayZ[i] == v)
return &arrayZ[i];
return nullptr;
}
void qsort (int (*cmp)(const void*, const void*)) void qsort (int (*cmp)(const void*, const void*))
{ as_array ().qsort (cmp); } { as_array ().qsort (cmp); }
void qsort (unsigned int start = 0, unsigned int end = (unsigned int) -1) void qsort (unsigned int start = 0, unsigned int end = (unsigned int) -1)