File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
Standard Template Library Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 131131 <ClInclude Include =" resource.h" />
132132 </ItemGroup >
133133 <ItemGroup >
134- <ClCompile Include =" Standard Template Library\Vectors.cpp" />
134+ <ClCompile Include =" Standard Template Library\Vectors-and-memory .cpp" />
135135 </ItemGroup >
136136 <Import Project =" $(VCTargetsPath)\Microsoft.Cpp.targets" />
137137 <ImportGroup Label =" ExtensionTargets" >
Original file line number Diff line number Diff line change 2020 </ClInclude >
2121 </ItemGroup >
2222 <ItemGroup >
23- <ClCompile Include =" Standard Template Library\Vectors.cpp" >
23+ <ClCompile Include =" Standard Template Library\Vectors-and-memory .cpp" >
2424 <Filter >Source Files</Filter >
2525 </ClCompile >
2626 </ItemGroup >
Original file line number Diff line number Diff line change @@ -9,6 +9,28 @@ using namespace std;
99
1010int main () {
1111
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+
1234
1335 return 0 ;
1436}
You can’t perform that action at this time.
0 commit comments