Skip to content

Findings during the advanced course #538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build-slides.yml
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ jobs:
with:
root_file: C++Course.tex
latexmk_shell_escape: true
latexmk_use_xelatex: true
args: -pdf -interaction=nonstopmode -halt-on-error -usepretex=\def\makebasic{}
working_directory: talk
extra_system_packages: "py-pygments"
@@ -37,6 +38,7 @@ jobs:
with:
root_file: C++Course.tex
latexmk_shell_escape: true
latexmk_use_xelatex: true
args: -pdf -interaction=nonstopmode -halt-on-error
working_directory: talk
extra_system_packages: "py-pygments"
2 changes: 1 addition & 1 deletion talk/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
all: C++Course.pdf

LATEXMK=latexmk
OPTIONS=-pdf -shell-escape -halt-on-error
OPTIONS=-pdf -xelatex -shell-escape -halt-on-error

essentials: all
essentials: OPTIONS+=-usepretex='\def\makebasic{}'
10 changes: 7 additions & 3 deletions talk/basicconcepts/scopesnamespaces.tex
Original file line number Diff line number Diff line change
@@ -159,8 +159,7 @@

\begin{frame}[fragile]
\frametitlecpp[17]{Nested namespaces}
Easier way to declare nested namespaces
\begin{alertblock}{\cpp98}
\begin{alertblock}{\cpp98: Old way to declare nested namespaces}
\begin{cppcode*}{}
namespace A {
namespace B {
@@ -171,13 +170,18 @@
}
\end{cppcode*}
\end{alertblock}
\begin{exampleblock}{\cpp17}
\begin{exampleblock}{\cpp17: Nested declaration}
\begin{cppcode*}{}
namespace A::B::C {
//...
}
\end{cppcode*}
\end{exampleblock}
\begin{exampleblock}{\cpp17: Namespace alias}
\begin{cppcode*}{}
namespace ABC = A::B::C;
\end{cppcode*}
\end{exampleblock}
\end{frame}

\begin{advanced}
6 changes: 3 additions & 3 deletions talk/expert/cpp20concepts.tex
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
<typename T,
typename = std::enable_if_t<std::is_floating_point_v<T>>>
bool equal( T e1, T e2 ) {
return std::abs(e1-e2)<std::numeric_limits<T>::epsilon();
return std::abs(e1-e2) < std::numeric_limits<T>::epsilon();
}
... equal(10,5+5) ...
\end{cppcode*}
@@ -62,7 +62,7 @@
template<typename T>
requires std::is_floating_point_v<T>
bool equal( T e1, T e2 ) {
return std::abs(e1-e2)<std::numeric_limits<T>::epsilon();
return std::abs(e1-e2) < std::numeric_limits<T>::epsilon();
}
... equal(10,5+5) ...
\end{cppcode*}
@@ -119,7 +119,7 @@
template< typename T>
concept MyFloatingPoint =
std::is_floating_point_v<T> &&
std::numeric_limits<T>::epsilon()>0;
std::numeric_limits<T>::epsilon() > 0;

template<typename T>
requires MyFloatingPoint<T>
2 changes: 1 addition & 1 deletion talk/morelanguage/initialization.tex
Original file line number Diff line number Diff line change
@@ -160,7 +160,7 @@
\item Unless \cppinline{T} has a \cppinline{std::initializer_list} constructor that you do not want to call!
\item Be wary of \cppinline{std::vector}!
\end{itemize}
\item The STL value initializes when creating new user objects
\item The STL uses value initialisation when resizing containers
\begin{itemize}
\item E.g. \cppinline{vec.resize(vec.size() + 10);}
\end{itemize}
2 changes: 1 addition & 1 deletion talk/morelanguage/lambda.tex
Original file line number Diff line number Diff line change
@@ -287,11 +287,11 @@
\end{itemize}
\end{block}
\begin{block}{Explicit template parameters (\cpp20)}
\begin{itemize}
\begin{cppcode*}{linenos=false,gobble=4}
auto add = []<typename T>(T a, T b)
{ return a + b; };
\end{cppcode*}
\begin{itemize}
\item The types of \cppinline{a} and \cppinline{b} must be the same.
\end{itemize}
\end{block}