Skip to content

Commit 98d51ae

Browse files
committed
.
1 parent d68ff01 commit 98d51ae

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

Advanced-Cpp-Programming.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
<ClInclude Include="Template Classes and Functions\Template-class.h" />
135135
</ItemGroup>
136136
<ItemGroup>
137-
<ClCompile Include="Cpp%2711 New features\Initializing-in-cpp-11.cpp" />
137+
<ClCompile Include="Cpp%2711 New features\Initializer-lists.cpp" />
138138
<ClCompile Include="Operator Overloading\Complex.cpp" />
139139
</ItemGroup>
140140
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

Advanced-Cpp-Programming.vcxproj.filters

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<ClCompile Include="Operator Overloading\Complex.cpp">
3333
<Filter>Source Files</Filter>
3434
</ClCompile>
35-
<ClCompile Include="Cpp%2711 New features\Initializing-in-cpp-11.cpp">
35+
<ClCompile Include="Cpp%2711 New features\Initializer-lists.cpp">
3636
<Filter>Source Files</Filter>
3737
</ClCompile>
3838
</ItemGroup>
+20-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
#include<iostream>
22
#include<vector>
3+
#include<initializer_list>
34

45
using namespace std;
56

7+
class Test {
8+
public:
9+
Test(initializer_list<string> texts) {
10+
for (auto value : texts)
11+
cout << value << endl;
12+
}
13+
14+
void print(initializer_list<string> l) {
15+
for (auto value : l) {
16+
cout << value << endl;
17+
}
18+
}
19+
20+
};
21+
622
int main() {
723

8-
vector<int> numbers{ 1, 3, 4 6 };
24+
vector<int> numbers{ 1, 3, 4, 6 };
25+
cout << numbers[2] << endl;
26+
27+
Test test{ "Hello", "how", "are", "you" };
928

1029
return 0;
1130
}

0 commit comments

Comments
 (0)