Interface change of List::find() and contains()

This commit is contained in:
Tsuda Kageyu 2013-05-21 12:45:35 +09:00
parent d982b846c4
commit ea6ab84c42
2 changed files with 12 additions and 6 deletions

View File

@ -204,17 +204,20 @@ namespace TagLib {
/*!
* Find the first occurrence of \a value.
*/
Iterator find(const T &value);
template <class U>
Iterator find(const U &value);
/*!
* Find the first occurrence of \a value.
*/
ConstIterator find(const T &value) const;
template <class U>
ConstIterator find(const U &value) const;
/*!
* Returns true if the list contains \a value.
*/
bool contains(const T &value) const;
template <class U>
bool contains(const U &value) const;
/*!
* Erase the item at \a it from the list.

View File

@ -281,19 +281,22 @@ bool List<T>::isEmpty() const
}
template <class T>
typename List<T>::Iterator List<T>::find(const T &value)
template <class U>
typename List<T>::Iterator List<T>::find(const U &value)
{
return std::find(d->list.begin(), d->list.end(), value);
}
template <class T>
typename List<T>::ConstIterator List<T>::find(const T &value) const
template <class U>
typename List<T>::ConstIterator List<T>::find(const U &value) const
{
return std::find(d->list.begin(), d->list.end(), value);
}
template <class T>
bool List<T>::contains(const T &value) const
template <class U>
bool List<T>::contains(const U &value) const
{
return std::find(d->list.begin(), d->list.end(), value) != d->list.end();
}