亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? extendedarraylist.h

?? datastucutre and algorithms, application, in C
?? H
字號:
// extended array implementation of a linear list
// This is arrayListWithIterator.h with methods to reset
// and clear linear lists and to set the value at an index added

#ifndef arrayList_
#define arrayList_

#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <iterator>
#include "linearList.h"
#include "myExceptions.h"
#include "changeLength1D.h"

using namespace std;

template<class T>
class arrayList : public linearList<T> 
{
   public:
      // constructor, copy constructor and destructor
      arrayList(int initialCapacity = 10);
      arrayList(const arrayList<T>&);
      ~arrayList() {delete [] element;}

      // ADT methods
      bool empty() const {return listSize == 0;}
      int size() const {return listSize;}
      T& get(int theIndex) const;
      int indexOf(const T& theElement) const;
      void erase(int theIndex);
      void insert(int theIndex, const T& theElement);
      void output(ostream& out) const;

      // additional methods
      int capacity() const {return arrayLength;}
      void reSet(int);
      void set(int, const T&);
      void clear() {listSize = 0;}
      
      // iterators to start and end of list
      class iterator;
      iterator begin() {return iterator(element);}
      iterator end() {return iterator(element + listSize);}

      // iterator for arrayList
      class iterator 
      {
         public:
            // typedefs required by C++ for a bidirectional iterator
            typedef bidirectional_iterator_tag iterator_category;
            typedef T value_type;
            typedef ptrdiff_t difference_type;
            typedef T* pointer;
            typedef T& reference;

            // constructor
            iterator(T* thePosition = 0) {position = thePosition;}

            // dereferencing operators
            T& operator*() const {return *position;}
            T* operator->() const {return &*position;}

            // increment
            iterator& operator++()   // preincrement
                      {++position; return *this;}
            iterator operator++(int) // postincrement
            	      {iterator old = *this;
            	       ++position;
            	       return old;
            	      }

            // decrement
            iterator& operator--()   // predecrement
                      {--position; return *this;}
            iterator operator--(int) // postdecrement
            	      {iterator old = *this;
            	       --position;
            	       return old;
            	      }

            // equality testing
            bool operator!=(const iterator right) const
                  {return position != right.position;}
            bool operator==(const iterator right) const
                  {return position == right.position;}
         protected:
            T* position;
      };  // end of iterator class

   protected:  // additional members of arrayList
      void checkIndex(int theIndex) const;
            // throw illegalIndex if theIndex invalid
      T* element;            // 1D array to hold list elements
      int arrayLength;       // capacity of the 1D array
      int listSize;          // number of elements in list
};

template<class T>
arrayList<T>::arrayList(int initialCapacity)
{// Constructor.
   if (initialCapacity < 1)
   {ostringstream s;
    s << "Initial capacity = " << initialCapacity << " Must be > 0";
    throw illegalParameterValue(s.str());
   }
   arrayLength = initialCapacity;
   element = new T[arrayLength];
   listSize = 0;
}

template<class T>
arrayList<T>::arrayList(const arrayList<T>& theList)
{// Copy constructor.
   arrayLength = theList.arrayLength;
   listSize = theList.listSize;
   element = new T[arrayLength];
   copy(theList.element, theList.element + listSize, element);
}

template<class T>
void arrayList<T>::reSet(int theSize)
{// Set list size to theSize and ensure that element array
 // is large enough for this many elements.
   if (theSize < 0)
   {ostringstream s;
    s << "Requested size = " << theSize << " Must be >= 0";
    throw illegalParameterValue(s.str());
   }

   if (theSize > arrayLength)
   {// need a larger array
      delete element;
      element = new T[theSize];
      arrayLength = listSize;
   }
   listSize = theSize;
}

template<class T>
void arrayList<T>::checkIndex(int theIndex) const
{// Verify that theIndex is between 0 and listSize - 1.
   if (theIndex < 0 || theIndex >= listSize)
   {ostringstream s;
    s << "index = " << theIndex << " size = " << listSize;
    throw illegalIndex(s.str());
   }
}

template<class T>
T& arrayList<T>::get(int theIndex) const
{// Return element whose index is theIndex.
 // Throw illegalIndex exception if no such element.
   checkIndex(theIndex);
   return element[theIndex];
}

template<class T>
void arrayList<T>::set(int theIndex, const T& newValue)
{// Set element whose index is theIndex to newValue.
 // Throw illegalIndex exception if no such element.
   checkIndex(theIndex);
   element[theIndex] = newValue;
}

template<class T>
int arrayList<T>::indexOf(const T& theElement) const
{// Return index of first occurrence of theElement.
 // Return -1 if theElement not in list.

   // search for theElement
   int theIndex = (int) (find(element, element + listSize, theElement)
                         - element);

   // check if theElement was found
   if (theIndex == listSize)
     // not found
     return -1;
   else return theIndex;
 }

template<class T>
void arrayList<T>::erase(int theIndex)
{// Delete the element whose index is theIndex.
 // Throw illegalIndex exception if no such element.
   checkIndex(theIndex);

   // valid index, shift elements with higher index
   copy(element + theIndex + 1, element + listSize,
                                element + theIndex);

   element[--listSize].~T(); // invoke destructor
}

template<class T>
void arrayList<T>::insert(int theIndex, const T& theElement)
{// Insert theElement so that its index is theIndex.
   if (theIndex < 0 || theIndex > listSize)
   {// invalid index
      ostringstream s;
      s << "index = " << theIndex << " size = " << listSize;
      throw illegalIndex(s.str());
   }

   // valid index, make sure we have space
   if (listSize == arrayLength)
      {// no space, double capacity
         changeLength1D(element, arrayLength, 2 * arrayLength);
         arrayLength *= 2;
      }

   // shift elements right one position
   copy_backward(element + theIndex, element + listSize,
                 element + listSize + 1);

   element[theIndex] = theElement;

   listSize++;
}

template<class T>
void arrayList<T>::output(ostream& out) const
{// Put the list into the stream out.
   copy(element, element + listSize, ostream_iterator<T>(cout, "  "));
}

// overload <<
template <class T>
ostream& operator<<(ostream& out, const arrayList<T>& x)
   {x.output(out); return out;}

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产馆精品极品| xfplay精品久久| 精品少妇一区二区三区| 国产精品―色哟哟| 日韩精品亚洲一区| 99精品桃花视频在线观看| 欧美久久久久久久久久| 国产婷婷色一区二区三区| 亚洲一区二区精品视频| 成人丝袜高跟foot| 3atv一区二区三区| 一区二区三区欧美日韩| 国产成人午夜精品5599| 91精品国产91热久久久做人人| 中文av一区特黄| 久久超碰97中文字幕| 欧美日韩亚洲综合一区二区三区| 中文字幕不卡的av| 国产一区二区三区最好精华液| 欧美日本韩国一区二区三区视频| 国产精品国产自产拍高清av| 国产乱对白刺激视频不卡| 欧美一级二级在线观看| 亚洲一区二区不卡免费| 91美女视频网站| 国产精品视频第一区| 国产成人综合精品三级| 久久久三级国产网站| 麻豆久久久久久久| 欧美一区2区视频在线观看| 亚洲午夜精品17c| 欧洲国产伦久久久久久久| 亚洲品质自拍视频网站| 91在线视频网址| 中文字幕日韩一区| 成人免费毛片高清视频| 国产精品亲子伦对白| 国产99久久久国产精品| 亚洲国产成人私人影院tom| 国产91丝袜在线观看| 国产日韩欧美在线一区| 成人一区二区三区中文字幕| 国产午夜精品久久久久久免费视| 国产成人自拍网| 日韩美女视频一区二区| 91理论电影在线观看| 亚洲综合一区二区精品导航| 欧美特级限制片免费在线观看| 亚洲国产精品人人做人人爽| 欧美二区乱c少妇| 久草在线在线精品观看| 国产欧美日韩在线| 91伊人久久大香线蕉| 亚洲午夜久久久| 日韩视频免费直播| 国产.精品.日韩.另类.中文.在线.播放| 久久久影视传媒| 91在线播放网址| 午夜精品视频一区| 精品少妇一区二区三区在线视频| 国产麻豆成人传媒免费观看| 亚洲少妇最新在线视频| 欧美日韩夫妻久久| 国产一区二区三区香蕉| 亚洲视频在线观看一区| 制服丝袜亚洲精品中文字幕| 国内精品久久久久影院一蜜桃| 国产免费久久精品| 欧美亚洲综合久久| 久久国产尿小便嘘嘘尿| 日韩毛片精品高清免费| 91精品国产综合久久久久久久| 国产麻豆9l精品三级站| 一区二区在线电影| 精品美女在线播放| 91麻豆精品视频| 蜜桃久久av一区| 亚洲欧美日韩人成在线播放| 欧美一区二区网站| 99久久99久久精品免费看蜜桃| 天堂久久久久va久久久久| 久久精品男人的天堂| 欧美色男人天堂| 国产成人综合在线| 日韩黄色一级片| 国产精品久久久久久久久久久免费看 | 成人美女视频在线观看18| 亚洲丰满少妇videoshd| 国产精品毛片a∨一区二区三区| 欧美精品乱码久久久久久| 成人三级在线视频| 美女视频免费一区| 亚洲一区二区在线免费观看视频| 久久久久久久久久久久电影| 777午夜精品视频在线播放| aa级大片欧美| 国产成人鲁色资源国产91色综| 日韩成人伦理电影在线观看| 亚洲日本免费电影| 国产区在线观看成人精品| 3751色影院一区二区三区| 在线精品视频一区二区| 99国产麻豆精品| 成人亚洲一区二区一| 国产一区二区三区日韩| 久久精品国产亚洲a| 亚洲成人精品在线观看| 亚洲韩国一区二区三区| 亚洲欧美另类综合偷拍| 国产精品每日更新| 欧美国产精品一区二区三区| 久久久亚洲精华液精华液精华液| 欧美一区二区精品| 欧美一区二区福利视频| 91精品国产综合久久蜜臀| 欧美三级韩国三级日本一级| 91黄视频在线观看| 色吧成人激情小说| 在线免费观看日韩欧美| 在线免费观看成人短视频| 9人人澡人人爽人人精品| 国产成人午夜精品5599| 国产91丝袜在线18| 成人av电影在线播放| 不卡一区二区中文字幕| 91在线精品秘密一区二区| av高清久久久| 91福利视频在线| 欧美精品在线视频| 69久久夜色精品国产69蝌蚪网| 欧美日韩在线播放一区| 日韩一区二区三区视频在线| 337p日本欧洲亚洲大胆精品| 久久久久久久国产精品影院| 国产精品毛片大码女人| 一区二区免费看| 亚洲第一电影网| 免费观看久久久4p| 国产精品888| 91丨porny丨户外露出| 在线欧美一区二区| 日韩欧美专区在线| 国产女人水真多18毛片18精品视频| 中文字幕欧美三区| 亚洲一区二区三区四区在线免费观看| 午夜天堂影视香蕉久久| 九九**精品视频免费播放| 国产传媒久久文化传媒| 91成人在线精品| 日韩久久精品一区| 国产精品乱子久久久久| 午夜婷婷国产麻豆精品| 国产精品一级在线| 91久久精品日日躁夜夜躁欧美| 日韩美一区二区三区| 日韩理论片在线| 美女视频网站黄色亚洲| 91同城在线观看| 欧美一级片在线| 成人免费视频在线观看| 蜜桃精品在线观看| 色老汉一区二区三区| 久久先锋资源网| 一区二区三区高清在线| 国产精品亚洲视频| 欧美色精品天天在线观看视频| 久久精子c满五个校花| 日韩精品高清不卡| 99国产精品国产精品毛片| 精品国产乱码久久久久久1区2区| 亚洲三级理论片| 久久成人免费网站| 欧美日韩一区二区三区视频| 国产精品久久一级| 国产九色sp调教91| 欧美精品第一页| 一区二区三区在线播| 国产精品亚洲а∨天堂免在线| 91精品国产综合久久福利软件| 亚洲人一二三区| 国产精品一品二品| 日韩午夜精品视频| 午夜欧美一区二区三区在线播放| 成人av资源在线| 国产色综合久久| 狠狠色丁香久久婷婷综| 制服丝袜在线91| 亚洲成人免费电影| 91久久精品网| 亚洲欧美二区三区| 北条麻妃国产九九精品视频| 26uuu精品一区二区三区四区在线| 亚洲成在线观看| 在线一区二区视频| 亚洲精品成人少妇| 色综合激情五月| 亚洲人成精品久久久久久| 99re视频精品| 最新久久zyz资源站| 不卡在线观看av|