diff --git a/talk/C++Course.tex b/talk/C++Course.tex index a1fb6c00..bb06acbc 100644 --- a/talk/C++Course.tex +++ b/talk/C++Course.tex @@ -147,7 +147,7 @@ \input{objectorientation/adl} \end{advanced} -\section[More]{Core modern \cpp} +\section[Core]{Core modern \cpp} \input{morelanguage/constness} \begin{advanced} \input{morelanguage/constexpr} diff --git a/talk/basicconcepts/assert.tex b/talk/basicconcepts/assert.tex index 5ad4cbc4..6911443c 100644 --- a/talk/basicconcepts/assert.tex +++ b/talk/basicconcepts/assert.tex @@ -77,7 +77,7 @@ \begin{cppcode*}{} double f(UserType a) { static_assert( - std::is_floating_point::value, + std::is_floating_point_v, // C++17 "This function expects floating-point types."); return std::sqrt(a); } @@ -89,7 +89,7 @@ \textcolor{blue}{a.cpp:3:9:} \textcolor{red}{error:} \textcolor{blue}{static assertion failed: This function} \textcolor{blue}{expects floating-point types.} 2 | static_assert( - | \textcolor{red}{std::is_floating_point::value}, - | \textcolor{red}{~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} + | \textcolor{red}{std::is_floating_point_v}, + | \textcolor{red}{~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~} \end{Verbatim} \end{frame} diff --git a/talk/basicconcepts/coresyntax.tex b/talk/basicconcepts/coresyntax.tex index 11362fad..13548059 100644 --- a/talk/basicconcepts/coresyntax.tex +++ b/talk/basicconcepts/coresyntax.tex @@ -173,12 +173,12 @@ #include // may define these: std::float16_t = 3.14f16; // 16 (1+5+10) bit float - std::float32_t = 3.14f32; // like float + std::float32_t = 3.14f32; // like float (1+8+23) // but different type - std::float64_t = 3.14f64; // like double + std::float64_t = 3.14f64; // like double (1+11+52) // but different type std::float128_t = 3.14f128; // 128 (1+15+112) bit float - std::bfloat_t = 3.14bf16; // 16 (1+8+7) bit float + std::bfloat16_t = 3.14bf16; // 16 (1+8+7) bit float // also F16, F32, F64, F128 or BF16 suffix possible \end{cppcode*} diff --git a/talk/morelanguage/copyelision.tex b/talk/morelanguage/copyelision.tex index adf5bd98..e5fd1917 100644 --- a/talk/morelanguage/copyelision.tex +++ b/talk/morelanguage/copyelision.tex @@ -2,7 +2,7 @@ \begin{frame}[fragile] \frametitlecpp[17]{Copy elision} - \begin{block}{Copy elision} + \begin{block}{Where does it take place ?} \small \begin{cppcode*}{} struct Foo { ... }; diff --git a/talk/morelanguage/morestl.tex b/talk/morelanguage/morestl.tex index 561143fe..e8ee92f5 100644 --- a/talk/morelanguage/morestl.tex +++ b/talk/morelanguage/morestl.tex @@ -99,7 +99,7 @@ \begin{cppcode*}{} std::optional parse_phone(std::string_view in) { if (is_valid_phone(in)) - return in; // equiv. to optional{in}; + return in; // equiv. to optional{in}; return {}; // or: return std::nullopt; (empty opt.) } if (v) { // or: v.is_valid() diff --git a/talk/objectorientation/typecasting.tex b/talk/objectorientation/typecasting.tex index ede5176f..5b45887f 100644 --- a/talk/objectorientation/typecasting.tex +++ b/talk/objectorientation/typecasting.tex @@ -23,7 +23,7 @@ \begin{frame}[fragile] \frametitlecpp[98]{Type casting example} \small - \begin{exampleblock}{} + \begin{exampleblockGB}{Practically}{https://godbolt.org/z/16faqc64s}{\texttt{casting}} \begin{cppcode*}{gobble=2} struct A{ virtual ~A()=default; } a; struct B : A {} b; @@ -34,9 +34,7 @@ B& f = dynamic_cast(c); // OK, c is a B B& g = dynamic_cast(a); // throws std::bad_cast - B& foo(A& h) { - return dynamic_cast(h); - } + B& foo(A& h) { return dynamic_cast(h); } B& i = foo(c); // OK, c is a B B* j = dynamic_cast(&a); // nullptr. a not a B. @@ -44,7 +42,7 @@ // Will not reach this } \end{cppcode*} - \end{exampleblock} + \end{exampleblockGB} \end{frame} \begin{frame}[fragile]