hsf-training / cpluspluscourse

C++ Course Taught at CERN, from Sebastien Ponce (LHCb)
Apache License 2.0
169 stars 65 forks source link

Add a slide on jthreads and simplify goodpractice environment #506

Closed hageboeck closed 8 months ago

hageboeck commented 8 months ago

Extend the discussion of jthread and stop_token as suggested in #272.

As a drive-by improvement, I refactored the goodpractice environment to take optional arguments. Now, only a single command with an optional argument is necessary to pass a shortened title for the index of good practices:

  \end{cppcode}
-  \begin{goodpracticeWithShortcut}{Don't use C's memory management}{C's memory management}
+  \begin{goodpractice}[C's memory management]{Don't use C's memory management}
    Use \cppinline{std::vector} and friends or smart pointers
-  \end{goodpracticeWithShortcut}
+  \end{goodpractice}
\end{frame}

This stays the same:

\begin{goodpractice}{Memory management}

Fix #272