Skip to content

Commit a78baaa

Browse files
committed
.
1 parent bf90b82 commit a78baaa

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

Advanced-Cpp-Programming.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
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">

Advanced-Cpp-Programming.vcxproj.filters

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
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>

Standard Template Library/Vectors-and-memory.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,28 @@ using namespace std;
99

1010
int 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
}

0 commit comments

Comments
 (0)