Merge pull request #212 from TsudaKageyu/list

Interface change of List::find() and contains()
This commit is contained in:
Tsuda Kageyu 2013-05-20 21:01:31 -07:00
commit 409bba5936
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();
}