00001
00002
00003
00004
00005
00006
00007 #ifndef INCLUDE__TVECTOR_H__FILE
00008 #define INCLUDE__TVECTOR_H__FILE
00009
00010 #include <vector>
00011
00015 template<class T>
00016 class EGTVector {
00017 public:
00018 typedef unsigned SizeType;
00019 typedef typename std::vector<T>::iterator Iterator;
00020 typedef typename std::vector<T>::const_iterator ConstIterator;
00021
00022 explicit EGTVector() : v_() { }
00023 explicit EGTVector(SizeType uSize, const T& val = T()) : v_(uSize, val) { }
00024 EGTVector(ConstIterator first, ConstIterator last) : v_(first, last) { }
00025 EGTVector(const EGTVector<T>& rhs) : v_(rhs.v_) { }
00026 ~EGTVector() { }
00027
00028 Iterator Begin() { return v_.begin(); }
00029 ConstIterator Begin() const { return v_.begin(); }
00030 Iterator End() { return v_.end(); }
00031 ConstIterator End() const { return v_.end(); }
00032
00033 SizeType Size() const { return v_.size(); }
00034 void Resize(SizeType uSize,
00035 T val = t()) { v_.resize(uSize, val);}
00036 bool Empty() { return v_.empty(); }
00037 void PushBack(const T& ret) { v_.push_back(ret); }
00038 void PopBack() { v_.pop_back(); }
00039 void Clear() { v_.clear(); }
00040 SizeType Capacity() { return v_.capacity(); }
00041 void Reserve(SizeType x) { v_.reserve(x); }
00042
00043 Iterator Insert(Iterator it, const T& x = T()) {
00044 return v_.insert(it, x);
00045 }
00046 void Insert(Iterator it, SizeType uSize, const T& x) {
00047 v_.insert(it, uSize, x);
00048 }
00049 void Insert(Iterator it, ConstIterator first, ConstIterator last) {
00050 v_.insert(it, first, last);
00051 }
00052 Iterator Erase(Iterator it) {
00053 return v_.erase(it);
00054 }
00055 Iterator Erase(Iterator first, Iterator last) {
00056 return v_.erase(first, last);
00057 }
00058 T& operator[](SizeType uIndex){
00059 return v_.operator[](uIndex);
00060 }
00061 const T& operator[](SizeType uIndex) const {
00062 return v_.operator[](uIndex);
00063 }
00064
00065 private:
00066 std::vector<T> v_;
00067 };
00068
00069 #endif //INCLUDE__TVECTOR_H__FILE