CPP
cpp
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 <vector>
using namespace std;
void* operator new (size_t size)
{
cout << "---------->Allocating " << size << " on heap\n";
return malloc(size);
}
int main()
{
{
vector<int> vect;
cout << "Sizeof is : " << sizeof(vect) << endl;
cout << "Capacity is : " << vect.capacity() << endl;
cout << "Size is : " << vect.size() << endl;
}
cout << endl << endl << endl;
{
vector<int> vect(55,0);
cout << "Sizeof is : " << sizeof(vect) << endl;
cout << "Capacity is : " << vect.capacity() << endl;
cout << "Size is : " << vect.size() << endl;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run