File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
\subsection [thr ]{Threads and async }
2
2
3
3
\begin {frame }[fragile]
4
- \frametitlecpp [11] {Basic concurrency}
4
+ \frametitle {Basic concurrency \hfill \cpp 11/ \cpp 20 }
5
5
\begin {block }{Threading}
6
6
\begin {itemize }
7
7
\item \cpp 11 added \mintinline {cpp}{std::thread} in \mintinline {cpp}{<thread>} header
Original file line number Diff line number Diff line change 167
167
f(4); // rvalue -> T&& is int&&
168
168
double d = 3.14;
169
169
f(d); // lvalue -> T&& is double&
170
- float f () {...}
171
- f(f ()); // rvalue -> T&& is float&&
170
+ float g () {...}
171
+ f(g ()); // rvalue -> T&& is float&&
172
172
std::string s = "hello" ;
173
173
f(s); // lvalue -> T&& is std::string&
174
174
f(std::move(s)); // rvalue -> T&& is std::string&&
Original file line number Diff line number Diff line change 82
82
\begin {exampleblock }{Example}
83
83
\begin {cppcode* }{}
84
84
template<typename... Args>
85
- T sum1(Args... args) {
85
+ auto sum1(Args... args) {
86
86
return (args + ...); // unary fold over +
87
87
} // parentheses mandatory
88
88
template<typename... Args>
89
- T sum2(Args... args) {
89
+ auto sum2(Args... args) {
90
90
return (args + ... + 0); // binary fold over +
91
91
} // parentheses mandatory
92
92
int sum = sum1(); // error
You can’t perform that action at this time.
0 commit comments