Commit 04794d70 authored by admin@ds-servers.com's avatar admin@ds-servers.com

Added Array::indexOf method

parent e3b3ec5e
......@@ -234,6 +234,25 @@ public:
}
}
int indexOf(const T &other)
{
return(indexOf(other, [](const T &a, const T &b){
return(a == b);
}));
}
template <typename L>
int indexOf(const T &other, const L& CompareFunc)
{
for(int i = 0, l = size(); i < l; ++i)
{
if(CompareFunc(operator[](i), other))
{
return(i);
}
}
return(-1);
}
protected:
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment