File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ project("template")
55set (CMAKE_CXX_STANDARD 23)
66set (CMAKE_CXX_STANDARD_REQUIRED ON )
77
8+ set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
9+
810add_executable (template_cls
911 "ClassTemplate/main.cpp"
1012 "ClassTemplate/Stack.hpp"
@@ -18,3 +20,9 @@ add_executable(template_fn
1820add_executable (template_notes
1921 "template_notes.cpp"
2022)
23+
24+ add_executable (template_for
25+ "template_for.cpp"
26+ )
27+
28+ target_compile_options (template_for PRIVATE -std=c++26 )
Original file line number Diff line number Diff line change 1+ #include < tuple>
2+
3+ std::tuple<int , char , double > get_tuple ();
4+
5+ struct Data {
6+ int a;
7+ char b;
8+ double c;
9+ };
10+
11+ Data get_data ();
12+
13+ void use (double );
14+ void use (char );
15+ void use (int );
16+
17+ int main () {
18+ template for (const auto & element : get_tuple ()) {
19+ // Do something with element
20+ use (element);
21+ }
22+ return 0 ;
23+ }
You can’t perform that action at this time.
0 commit comments