1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| #include<iostream> #include<string> #include"blob.h"
using namespace std;
int main(int argc, char** argv) { cout << "普通版本功能测试" << endl; blob<int> a = {1,2,3,4,5,6,7,8}; cout << a.back() << endl; cout << a[2] << endl; blob<string> b = { "abc","def","ghi","jkl" }; blobptr<string> ib2(b, 2); cout << *ib2 << endl; auto ib = b.begin(); cout<< *ib <<endl; cout<< *(++ib) <<endl; cout << "const版本功能测试" << endl; const blob<int> ca = { 1,2,3,4,5,6,7,8 }; cout << ca.back() << endl; cout << ca[2] << endl; const blob<string> cb = { "abc","def","ghi","jkl" }; auto icb = cb.begin(); cout << *icb << endl; }
|