Initial Patch of Auction House bot rev. 135
[auctionmangos.git] / dep / ACE_wrappers / ace / Vector_T.inl
blob4b773109a842ed8283edd6c92e048d562e939871
1 // -*- C++ -*-
2 //
3 // $Id: Vector_T.inl 81478 2008-04-28 13:22:26Z schmidt $
5 #include <algorithm>
7 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
9 template <class T, size_t DEFAULT_SIZE> ACE_INLINE
10 ACE_Vector<T, DEFAULT_SIZE>::ACE_Vector (const size_t init_size,
11                                          ACE_Allocator* alloc)
12   : ACE_Array<T> (init_size == 0 ? DEFAULT_SIZE : init_size, alloc),
13     length_ (0)
15   this->curr_max_size_ = this->max_size ();
18 template <class T, size_t DEFAULT_SIZE> ACE_INLINE
19 ACE_Vector<T, DEFAULT_SIZE>::~ACE_Vector ()
23 template <class T, size_t DEFAULT_SIZE> ACE_INLINE
24 size_t ACE_Vector<T, DEFAULT_SIZE>::capacity (void) const
26   return curr_max_size_;
29 template <class T, size_t DEFAULT_SIZE> ACE_INLINE
30 size_t ACE_Vector<T, DEFAULT_SIZE>::size (void) const
32   return length_;
35 template <class T, size_t DEFAULT_SIZE> ACE_INLINE
36 void ACE_Vector<T, DEFAULT_SIZE>::clear (void)
38   length_ = 0;
41 template <class T, size_t DEFAULT_SIZE> ACE_INLINE
42 void ACE_Vector<T, DEFAULT_SIZE>::pop_back (void)
44   if (length_ > 0)
45     {
46       --length_;
47       ACE_Array<T>::size (length_);
48     }
51 // Compare this vector with <s> for inequality.
53 template <class T, size_t DEFAULT_SIZE> ACE_INLINE bool
54 ACE_Vector<T, DEFAULT_SIZE>::operator!= (const ACE_Vector<T, DEFAULT_SIZE> &s) const
56   return !(*this == s);
59 template <class T, size_t DEFAULT_SIZE> ACE_INLINE void
60 ACE_Vector<T, DEFAULT_SIZE>::swap (ACE_Vector &rhs)
62   ACE_Array<T>::swap (rhs);
63   std::swap (this->length_, rhs.length_);
64   std::swap (this->curr_max_size_, rhs.curr_max_size_);
67 // ****************************************************************
69 template <class T, size_t DEFAULT_SIZE> ACE_INLINE void
70 ACE_Vector_Iterator<T, DEFAULT_SIZE>::dump (void) const
72   // ACE_TRACE ("ACE_Vector_Iterator<T>::dump");
75 template <class T, size_t DEFAULT_SIZE> ACE_INLINE
76 ACE_Vector_Iterator<T, DEFAULT_SIZE>::ACE_Vector_Iterator (ACE_Vector<T, DEFAULT_SIZE> &v)
77     : current_ (0),
78       vector_ (v)
80   // ACE_TRACE ("ACE_Vector_Iterator<T>::ACE_Vector_Iterator");
83 template <class T, size_t DEFAULT_SIZE> ACE_INLINE int
84 ACE_Vector_Iterator<T, DEFAULT_SIZE>::advance (void)
86   // ACE_TRACE ("ACE_Vector_Iterator<T>::advance");
88   if (this->current_ < vector_.size ())
89     {
90       ++this->current_;
91       return 1;
92     }
93   else
94     // Already finished iterating.
95     return 0;
98 template <class T, size_t DEFAULT_SIZE> ACE_INLINE int
99 ACE_Vector_Iterator<T, DEFAULT_SIZE>::done (void) const
101   ACE_TRACE ("ACE_Vector_Iterator<T>::done");
103   return this->current_ >= vector_.size ();
106 ACE_END_VERSIONED_NAMESPACE_DECL