Permalink
Browse files

fixup! Fix documentation of internal_vector and internal_stack

  • Loading branch information...
1 parent c73c423 commit d75f748d3f4411dadb0ae12cf318f4d64491f38c @Mortal Mortal committed Oct 26, 2012
Showing with 43 additions and 0 deletions.
  1. +1 −0 tpie/internal_stack_vector_base.h
  2. +42 −0 tpie/internal_vector.h
@@ -37,6 +37,7 @@ namespace tpie {
template <typename T, typename child_t>
class internal_stack_vector_base: public linear_memory_base<child_t> {
protected:
+ /** Element storage. */
array<T> m_elements;
/** Number of elements pushed to the structure. */
View
@@ -48,18 +48,41 @@ class internal_vector: public internal_stack_vector_base<T,internal_vector<T> >
///////////////////////////////////////////////////////////////////////////
internal_vector(size_t size=0): parent_t(size){}
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief Element access. No range checking is done.
+ ///////////////////////////////////////////////////////////////////////////
inline T & operator[](size_t s){return m_elements[s];}
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief Element access. No range checking is done.
+ ///////////////////////////////////////////////////////////////////////////
inline const T & operator[](size_t s)const {return m_elements[s];}
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief Get the first item pushed. Requires \c !empty().
+ ///////////////////////////////////////////////////////////////////////////
inline T & front(){return m_elements[0];}
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief Get the first item pushed. Requires \c !empty().
+ ///////////////////////////////////////////////////////////////////////////
inline const T & front()const {return m_elements[0];}
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief Get the last item pushed. Requires \c !empty().
+ ///////////////////////////////////////////////////////////////////////////
inline T & back(){return m_elements[m_size-1];}
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief Get the last item pushed. Requires \c !empty().
+ ///////////////////////////////////////////////////////////////////////////
inline const T & back()const {return m_elements[m_size-1];}
///////////////////////////////////////////////////////////////////////////
/// \brief Add an element to the end of the vector.
///
+ /// Iterators are invalidated by this call.
+ ///
/// \param val The element to add.
///////////////////////////////////////////////////////////////////////////
inline T & push_back(const T & val){m_elements[m_size++] = val; return back();}
@@ -69,18 +92,37 @@ class internal_vector: public internal_stack_vector_base<T,internal_vector<T> >
/// structure, push it to the structure again; otherwise, push the default
/// value.
///
+ /// Iterators are invalidated by this call.
+ ///
/// \param val The element to add.
///////////////////////////////////////////////////////////////////////////
inline T & push_back(){++m_size; return back();}
///////////////////////////////////////////////////////////////////////////
/// \brief Remove the last element from the vector.
+ ///
+ /// Iterators are invalidated by this call.
///////////////////////////////////////////////////////////////////////////
inline void pop_back(){--m_size;}
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief Get an iterator to the beginning of the structure.
+ ///////////////////////////////////////////////////////////////////////////
inline iterator begin(){ return m_elements.begin();}
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief Get an iterator to the beginning of the structure.
+ ///////////////////////////////////////////////////////////////////////////
inline const_iterator begin()const {return m_elements.begin();}
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief Get an iterator to the end of the structure.
+ ///////////////////////////////////////////////////////////////////////////
inline iterator end(){return m_elements.find(m_size);}
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// \brief Get an iterator to the end of the structure.
+ ///////////////////////////////////////////////////////////////////////////
inline const_iterator end()const {return m_elements.find(m_size);}
};

0 comments on commit d75f748

Please sign in to comment.