stl类vector

template<class T>class std::vector
{
	public:
		vector();
		//Default constructor
		//Precondition :None;
		//Postcondition :An empty vector exists.
		vector(size_type n);
		//Creates a vector with n elements
		//Precondition :None;
		//Postcondition :A vector of n elements exists
		bool empty()const;
		//Detemines whether the vector is empty
		//Precondition :None;
		//Postcondition :Return  true if the vector is empty
		//otherwise returns false
		size_type size()const;
		//Detemines the length of the vector
		//the return type size_type is an integral type
		//Precondition :None;
		//Postcondition :returns the number of the items that
		//are currenty in the vector
		void push_back(const T &)
		//Inserts a new element at the end of the vector.
		//precondition :none
		//postcondition :the new element is the last element
		//in vector
		void pop_back();
		//removes the last element of the vector
		//Precondition :there is at least one element in the
		//vector
		//postcondition :the last element of the vector is removed
		iterator insert(interator i,const T &);
		//Insert an item into the vector
		//before the element specified by the iterator
		//Precondition :the iterator is initialized
		//postcondition :Item val is inserted into the vector
		//and an iterator to the newly inserted item is return
		iterator erase(iterator i);
		//remove element at i
		//precondition : the iterator must be initialized
		//postcondition :returns the iterators to the item
		//following the removed item
		void clear();
		//Erases all the elements in the vector
		//precondition :NOne;
		//postcondition :the vector has no elements
		iterator begin();
		//returns an iterator to the first item in the vector
		//precondition :None;
		//postcondition :if the vector is empty
		//the value returned by the end() is returned
		iterator end();
		//returns an iterator to test for the end of
		//the vector
		//precondition :None;
		//Postcondition :the value for the end of the vector
		//was returned
};

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值