9
#include "placementalloc.h"
10
#include "plainalloc.h"
17
int main(int argc, char **argv)
22
cout << "Provide argument to read from stdin:\n"
23
"n: read strings, using NewAlloc with a vector\n"
24
"p: read strings, using PlacementAlloc with a deque\n"
25
"s: read ints, using a simple PlainAlloc with a list\n";
30
Storage<string, NewAlloc> storage;
32
copy(istream_iterator<string>(cin), istream_iterator<string>(),
33
back_inserter(storage));
35
cout << "Element index 1 is " << storage[1] << endl;
38
copy(storage.begin(), storage.end(),
39
ostream_iterator<NewAlloc<string> >(cout, "\n"));
45
Storage<string, PlacementAlloc, deque> storage;
47
copy(istream_iterator<string>(cin), istream_iterator<string>(),
48
back_inserter(storage));
50
copy(storage.begin(), storage.end(),
51
ostream_iterator<PlacementAlloc<string> >(cout, "\n"));
57
Storage<int, PlainAlloc, list> storage;
59
copy(istream_iterator<int>(cin), istream_iterator<int>(),
60
back_inserter(storage));
62
copy(storage.begin(), storage.end(),
63
ostream_iterator<PlainAlloc<int> >(cout, "\n"));