File tree 3 files changed +24
-2
lines changed
Standard Template Library
3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 131
131
<ClInclude Include =" resource.h" />
132
132
</ItemGroup >
133
133
<ItemGroup >
134
- <ClCompile Include =" Standard Template Library\Vectors.cpp" />
134
+ <ClCompile Include =" Standard Template Library\Vectors-and-memory .cpp" />
135
135
</ItemGroup >
136
136
<Import Project =" $(VCTargetsPath)\Microsoft.Cpp.targets" />
137
137
<ImportGroup Label =" ExtensionTargets" >
Original file line number Diff line number Diff line change 20
20
</ClInclude >
21
21
</ItemGroup >
22
22
<ItemGroup >
23
- <ClCompile Include =" Standard Template Library\Vectors.cpp" >
23
+ <ClCompile Include =" Standard Template Library\Vectors-and-memory .cpp" >
24
24
<Filter >Source Files</Filter >
25
25
</ClCompile >
26
26
</ItemGroup >
Original file line number Diff line number Diff line change @@ -9,6 +9,28 @@ using namespace std;
9
9
10
10
int main () {
11
11
12
+ vector<double > numbers (0 );
13
+
14
+ cout << " Size: " << numbers.size () << endl;
15
+
16
+ int capacity = numbers.capacity ();
17
+ cout << " Capactity: " << capacity << endl;
18
+ for (int i = 0 ; i < 10000 ; i++)
19
+ {
20
+ if (numbers.capacity () != capacity) {
21
+ capacity = numbers.capacity ();
22
+ cout << " Capactity: " << capacity << endl;
23
+ }
24
+
25
+ numbers.push_back (i);
26
+
27
+ }
28
+
29
+ numbers.resize (100 );
30
+ cout << numbers[2 ] << endl;
31
+ cout << " Size: " << numbers.size () << endl;
32
+ cout << " Capactity: " << capacity << endl;
33
+
12
34
13
35
return 0 ;
14
36
}
You can’t perform that action at this time.
0 commit comments