You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
\begin{exampleblockGB}{User code}{https://godbolt.org/z/qx46Pa4v3}{Resuming a coroutine}
238
238
\begin{cppcode*}{gobble=2}
239
239
Task myCoroutine() {
240
240
std::cout << "Step 1 of coroutine\n";
@@ -252,7 +252,7 @@ \subsection{Coroutines}
252
252
// c.resume(); // would segfault!
253
253
}
254
254
\end{cppcode*}
255
-
\end{block}
255
+
\end{exampleblockGB}
256
256
\begin{block}{}
257
257
\begin{minted}[gobble=4]{text}
258
258
Step 1 of coroutine
@@ -350,7 +350,7 @@ \subsection{Coroutines}
350
350
351
351
\begin{frame}[fragile]
352
352
\frametitlecpp[20]{\texttt{co\_yield} - final usage}
353
-
\begin{exampleblock}{Finally, we can use the generator nicely - \godboltLink{https://godbolt.org/z/6bbrYrss5}}
353
+
\begin{exampleblockGB}{Finally, we can use the generator nicely}{https://godbolt.org/z/6bbrYrss5}{\texttt{co\_yield}}
354
354
{\scriptsize
355
355
\begin{cppcode*}{gobble=4}
356
356
Task range(int first, int last) {
@@ -363,7 +363,7 @@ \subsection{Coroutines}
363
363
} // 1 2 3 4 5 6 7 8 9
364
364
\end{cppcode*}
365
365
}
366
-
\end{exampleblock}
366
+
\end{exampleblockGB}
367
367
\pause
368
368
\begin{alertblock}{Wait a minute: 0 is missing in the output!}
369
369
\begin{itemize}
@@ -386,7 +386,7 @@ \subsection{Coroutines}
386
386
387
387
\begin{frame}[fragile]
388
388
\frametitlecpp[20]{Laziness allows for infinite ranges}
389
-
\begin{block}{Generators do not need to be finite - \godboltLink{https://godbolt.org/z/MP6qdGWYe}}
389
+
\begin{exampleblockGB}{Generators do not need to be finite}{https://godbolt.org/z/MP6qdGWYe}{Infinite generator}
390
390
\begin{cppcode*}{gobble=2}
391
391
Task range(int first) {
392
392
while (true) {
@@ -397,12 +397,12 @@ \subsection{Coroutines}
397
397
std::cout << i << "\n";
398
398
}
399
399
\end{cppcode*}
400
-
\end{block}
400
+
\end{exampleblockGB}
401
401
\end{frame}
402
402
403
403
\begin{frame}[fragile]
404
404
\frametitlecpp[20]{Real life example}
405
-
\begin{block}{A Fibonacci generator, from \cpprefLink{https://en.cppreference.com/w/cpp/language/coroutines} - \godboltLink{https://godbolt.org/z/3Pev1M8se}}
405
+
\begin{exampleblockGB}{A Fibonacci generator, from \cpprefLink{https://en.cppreference.com/w/cpp/language/coroutines}}{https://godbolt.org/z/3Pev1M8se}{Fibonacci generator}
406
406
\scriptsize
407
407
\begin{cppcode*}{gobble=2}
408
408
Task<long long int> fibonacci(unsigned n) {
@@ -427,7 +427,7 @@ \subsection{Coroutines}
427
427
}
428
428
}
429
429
\end{cppcode*}
430
-
\end{block}
430
+
\end{exampleblockGB}
431
431
\end{frame}
432
432
433
433
\begin{frame}
@@ -495,7 +495,7 @@ \subsection{Coroutines}
495
495
496
496
\begin{frame}[fragile]
497
497
\frametitlecpp[20]{\texttt{awaiter} example}
498
-
\begin{block}{Switch to new thread, from \cpprefLink{https://en.cppreference.com/w/cpp/language/coroutines} - \godboltLink{https://godbolt.org/z/K7svE4P7s}}
498
+
\begin{exampleblockGB}{Switch to new thread, from \cpprefLink{https://en.cppreference.com/w/cpp/language/coroutines}}{https://godbolt.org/z/K7svE4P7s}{Thread switching}
0 commit comments