练习12.26
1 #include2 #include 3 #include 4 5 using namespace std; 6 7 int main() 8 { 9 string str;10 allocator alloc;11 auto p = alloc.allocate(15);12 auto q = p;13 while (cin >> str && q != p + 15)14 alloc.construct(q++, str);15 const size_t size = q - p;16 for (auto i = 0; i != size; ++i)17 cout << p[i] << endl;18 while (q != p)19 alloc.destroy(--q);20 alloc.deallocate(p, 15);21 system("pause");22 return 0;23 }