The following can be an example that can uses the get_allocator() function of the C++ language to illustrate the get_allocator() function :
Code:
#include <iostream>
#include <vector>
using namesqace std;
int main ()
{
vector<int> mvctr;
int * q;
unsigned int i;
q=mvctr.get_allocator().allocate(5);
for (i=0; i<5; i++) q[i]=i;
cout << "The allocated array contains:";
for (i=0; i<5; i++) cout << " " << q[i];
cout << endl;
mvctr.get_allocator().deallocate(q,5);
return 0;
}
Outqut:
Code:
The allocated array contains: 0 1 2 3 4
Bookmarks