Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Vector_T.cpp
blob393ea530c634f49222c234c7320cbe01a8b680d1
1 #ifndef ACE_VECTOR_T_CPP
2 #define ACE_VECTOR_T_CPP
4 #if !defined (ACE_LACKS_PRAGMA_ONCE)
5 # pragma once
6 #endif /* ACE_LACKS_PRAGMA_ONCE */
8 #include "ace/Vector_T.h"
10 #if !defined (__ACE_INLINE__)
11 #include "ace/Vector_T.inl"
12 #endif /* __ACE_INLINE__ */
14 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
16 ACE_ALLOC_HOOK_DEFINE_Tcs(ACE_Vector)
18 template <class T, size_t DEFAULT_SIZE>
19 void ACE_Vector<T, DEFAULT_SIZE>::resize (const size_t new_size,
20 const T& t)
22 ACE_Array<T>::size (new_size);
23 if (new_size > length_)
24 for (size_t i = length_; i < new_size; ++i)
25 (*this)[i]=t;
27 curr_max_size_ = this->max_size ();
28 length_ = new_size;
31 template <class T, size_t DEFAULT_SIZE>
32 void ACE_Vector<T, DEFAULT_SIZE>::push_back (const T& elem)
34 if (length_ == curr_max_size_)
36 ACE_Array<T>::size (curr_max_size_ * 2);
37 curr_max_size_ = this->max_size ();
39 else
40 ACE_Array<T>::size (length_ + 1);
42 ++length_;
43 (*this)[length_-1] = elem;
46 template <class T, size_t DEFAULT_SIZE>
47 void ACE_Vector<T, DEFAULT_SIZE>::dump () const
51 // Compare this vector with <s> for equality.
52 template <class T, size_t DEFAULT_SIZE> bool
53 ACE_Vector<T, DEFAULT_SIZE>::operator== (const ACE_Vector<T, DEFAULT_SIZE> &s) const
55 if (this == &s)
56 return true;
57 else if (this->size () != s.size ())
58 return false;
60 const size_t len = s.size ();
61 for (size_t slot = 0; slot < len; ++slot)
62 if ((*this)[slot] != s[slot])
63 return false;
65 return true;
68 // ****************************************************************
69 ACE_ALLOC_HOOK_DEFINE_Tcs(ACE_Vector_Iterator)
71 template <class T, size_t DEFAULT_SIZE> int
72 ACE_Vector_Iterator<T, DEFAULT_SIZE>::next (T *&item)
74 // ACE_TRACE ("ACE_Vector_Iterator<T>::next");
76 if (this->done ())
78 item = 0;
79 return 0;
81 else
83 item = &vector_[current_];
84 return 1;
88 ACE_END_VERSIONED_NAMESPACE_DECL
90 #endif /* ACE_VECTOR_T_CPP */