分享

向量Vector 应用例子

 BUPT-BYR 2010-12-20

向量Vector 应用例子
#include <iostream>
#include "Vector.h"
int main() {
using namespace std;
Vector<double> v;
cout << v.size() << endl;
cout << v.capacity() << endl;
v.reserve(20);
for(int i = 0, i < 20, i++)
v.push_back(double(i));
v[2] = 0.5; //v.operator[ ](2) = 0.5;
v.pop_back();
cout << v.size() << endl;
cout << v.capacity() << endl;
Vector<double>::Iterator first = v.begin();
Vector<double>::Iterator last = v.end();
for( ; first != last; ++first)
cout << *first <<endl;
}

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约