错误代码*********
//#include <iostream>
//#include <cstring>
//#include<vector>
//using namespace std;
////创建函数模板类
//template <typename T>
//class Myvector
//{
//private:
// //指向表首
// T *first;
// //指向表尾的后一位
// T *end;
// //指向表尾
// T *last;
// //现有空间的大小
// int len = 0;
// int size_t = 0;
//public:
// //无参构造
// Myvector();
// //有参构造函数
// Myvector(int size = 1);
// //析构函数
// ~Myvector();
// //拷贝构造
// Myvector(const Myvector &other);
//// 拷贝赋值
//// Myvector &operator = (const Myvector &other);
// //中括号[]
// T &operator [](const int index);
// //at函数
// T &at(int pos);
// //empty函数
// bool empty();
// //full
// bool full();
// //front函数
// T &front()const;
// //back函数
// T &back();
// //size函数
// int my_size();
// //clear函数
// void claer();
// //二倍扩容
// void expand();
// //push_back
// void push_back(const T e);
// //pop_back
// void pop_back(void);
//// //遍历
//// void soft();
//};
////无参构造
//template <typename T>
//Myvector<T> ::Myvector():first(nullptr), end(nullptr), last(nullptr)
//{
//}
////有参构造
//template <typename T>
//Myvector<T> ::Myvector(int size)
//{
// first = new T[size]; //创建空间
// last = first;
// end = first + size; //end指向尾部的后一位
//}
////析构函数
//template <typename T>
//Myvector<T> ::~Myvector()
//{
// //first不为空delete删除
// if(nullptr != first)
// {
// delete []first;
// }
// //全部指向为空
// first = end = last = nullptr;
//}
////拷贝构造函数
//template <typename T>
//Myvector<T> ::Myvector(const Myvector &other)
//{
// //计算原始空间大小
// this -> len = other.last - other.first;
// //创建新的容量
// this -> first = new T[len];
// //拷贝进入新的空间
// memcpy(this -> first, other -> first, len * sizeof(T));
// //指向新表首尾的位置
// this -> last = this -> first + len;
// this -> end = this -> last;
//}
////拷贝赋值函数
////template <typename T>
////Myvector<T> &Myvector<T> ::operator = (const Myvector &other)
////{
//// if(this != &other)
//// {
//// this -> first = other.first;
//// this -> end = other.end;
//// this -> size_t = other.size_t;
//// }
////}
////中括号[]
//template <typename T>
//T &Myvector<T> ::operator[](const int index)
//{
// return *(first + index);
//}
////at函数
//template <typename T>
//T &Myvector<T> ::at(int pos)
//{
// if(pos < 0 && pos > last - first)
// {
// cout << "下标超出范围" << endl;
// }
// else
// {
// return first[pos];
// }
//}
////empty函数
//template <typename T>
//bool Myvector<T> ::empty()
//{
// return first == last;
//}
////full函数
//template <typename T>
//bool Myvector<T> ::full()
//{
// return last == end;
//}
////front函数
//template <typename T>
//T &Myvector<T> ::front()const
//{
// //取得第一个首地址
// return *first;
//}
////back函数
//template <typename T>
//T &Myvector<T> ::back()
//{
// //返回最后一个值
// return *end;
//}
////size函数
//template <typename T>
//int Myvector<T> ::my_size()
//{
// return last - first;
//}
////clear函数
//template <typename T>
//void Myvector<T> ::claer()
//{
// if(empty() == 0)
// {
// cout << "数据为空" << endl;
// }
// while(last != first)
// {
// memset(begin, 0, sizeof(T) * (last - first + 1));
// }
//}
////二倍扩容
//template <typename T>
//void Myvector<T> ::expand()
//{
// len = end - first;
// T *temp = new T(2 * len);
// memcmp(temp, first, sizeof(T) * len);
// delete []first;
// first = temp;
// last = first + len;
// end = first + 2 * len;
//}
////push_back
//template <typename T>
//void Myvector<T> ::push_back(const T e)
//{
// if(full() == 0)
// {
// cout << "数据已满" << endl;
// cout << "进行二倍扩容" << endl;
// expand();
// }
// *last = e;
// last++;
//}
////pop_back
//template <typename T>
//void Myvector<T> ::pop_back(void)
//{
// if(empty() == 0)
// {
// cout << "数据为空" << endl;
// return;
// }
// last--;
//}
//////遍历
////template <typename T>
////void Myvector<T> ::soft()
////{
//// for(int i = 0; i <= end - first; i++)
//// {
//// cout << last[i] << endl;
//// }
////}
//int main()
//{
// Myvector<int> v(1);
// for(int i = 0; i < 5; i++)
// {
// v.push_back(i);
// }
// cout << "v.at(1) = " << v.at(1) << endl;
// cout << "front = " << v.front() << endl;
// cout << "back = " << v.back() << endl;
// cout << "pop_back " << v.pop_back();
//// <<" size = " << v.my_size() << endl;
// return 0;
//}