From bd3ed7497a1ab91bd3d4fa1e4b1219ee84aaa945 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 30 Jun 2003 01:00:23 +0000 Subject: [PATCH] Apparently invoking non-static member functions for default arguments doesn't work. Removed the default argument for Find() and added respective additional versions. Some more minor changes. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3754 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/util/Vector.h | 105 +++++++++++++++++---------- 1 file changed, 68 insertions(+), 37 deletions(-) diff --git a/headers/private/kernel/util/Vector.h b/headers/private/kernel/util/Vector.h index faf36ad6d3..08cedcf79d 100644 --- a/headers/private/kernel/util/Vector.h +++ b/headers/private/kernel/util/Vector.h @@ -88,9 +88,10 @@ public: inline Value &ElementAt(int32 index); int32 IndexOf(const Value &value, int32 start = 0) const; - Iterator Find(const Value &value, const Iterator &start = Begin()); - ConstIterator Find(const Value &value, - const ConstIterator &start = Begin()) const; + Iterator Find(const Value &value); + Iterator Find(const Value &value, const Iterator &start); + ConstIterator Find(const Value &value) const; + ConstIterator Find(const Value &value, const ConstIterator &start) const; inline Value &operator[](int32 index); inline const Value &operator[](int32 index) const; @@ -431,7 +432,7 @@ _VECTOR_CLASS_NAME::IsEmpty() const } // MakeEmpty -/*! \brief Removes all elements of the vector. +/*! \brief Removes all elements from the vector. */ _VECTOR_TEMPLATE_LIST void @@ -474,38 +475,6 @@ _VECTOR_CLASS_NAME::Begin() const return ConstIterator(fItems); } -// Null -/*! \brief Returns an invalid iterator. - - Null() is used as a return value, if something went wrong. It must - neither be incremented or decremented nor dereferenced! - - \return An invalid iterator. -*/ -_VECTOR_TEMPLATE_LIST -inline -_VECTOR_CLASS_NAME::Iterator -_VECTOR_CLASS_NAME::Null() -{ - return Iterator(NULL); -} - -// Null -/*! \brief Returns an invalid iterator. - - Null() is used as a return value, if something went wrong. It must - neither be incremented or decremented nor dereferenced! - - \return An invalid iterator. -*/ -_VECTOR_TEMPLATE_LIST -inline -_VECTOR_CLASS_NAME::ConstIterator -_VECTOR_CLASS_NAME::Null() const -{ - return ConstIterator(NULL); -} - // End /*! \brief Returns an iterator referring to the end of the vector. @@ -538,6 +507,38 @@ _VECTOR_CLASS_NAME::End() const return ConstIterator(fItems + fItemCount); } +// Null +/*! \brief Returns an invalid iterator. + + Null() is used as a return value, if something went wrong. It must + neither be incremented or decremented nor dereferenced! + + \return An invalid iterator. +*/ +_VECTOR_TEMPLATE_LIST +inline +_VECTOR_CLASS_NAME::Iterator +_VECTOR_CLASS_NAME::Null() +{ + return Iterator(NULL); +} + +// Null +/*! \brief Returns an invalid iterator. + + Null() is used as a return value, if something went wrong. It must + neither be incremented or decremented nor dereferenced! + + \return An invalid iterator. +*/ +_VECTOR_TEMPLATE_LIST +inline +_VECTOR_CLASS_NAME::ConstIterator +_VECTOR_CLASS_NAME::Null() const +{ + return ConstIterator(NULL); +} + // IteratorForIndex /*! \brief Returns an iterator for a given index. \return An iterator referring to the same element as \a index, or @@ -623,7 +624,22 @@ _VECTOR_CLASS_NAME::IndexOf(const Value &value, int32 start) const } // Find -/*! \brief Returns an iterator referring to the of the next element with the +/*! \brief Returns an iterator referring to the next element with the + specified value. + \param value The value of the element to be found. + \return An iterator referring to the found element, or End(), if no + further with the given value could be found. +*/ +_VECTOR_TEMPLATE_LIST +inline +_VECTOR_CLASS_NAME::Iterator +_VECTOR_CLASS_NAME::Find(const Value &value) +{ + return Find(value, Begin()); +} + +// Find +/*! \brief Returns an iterator referring to the next element with the specified value. \param value The value of the element to be found. \param start And iterator specifying where to start searching for the @@ -642,6 +658,21 @@ _VECTOR_CLASS_NAME::Find(const Value &value, const Iterator &start) return End(); } +// Find +/*! \brief Returns an iterator referring to the of the next element with the + specified value. + \param value The value of the element to be found. + \return An iterator referring to the found element, or End(), if no + further with the given value could be found. +*/ +_VECTOR_TEMPLATE_LIST +inline +_VECTOR_CLASS_NAME::ConstIterator +_VECTOR_CLASS_NAME::Find(const Value &value) const +{ + return Find(value, Begin()); +} + // Find /*! \brief Returns an iterator referring to the of the next element with the specified value.