Modern-CPP-Programming icon indicating copy to clipboard operation
Modern-CPP-Programming copied to clipboard

[Typo] 09.Templates_I.pdf

Open jakeheke75 opened this issue 1 year ago • 0 comments

Hello Federico, I completed the lecture and I collected some observations. Slide 31: just because I am a total newbie without almost any previous C++ experience, it was not immediate for me that decltype is returning a type to be used in a subsequent declaration. image Therefore I was able to understand fully the example only when I tried to compile the following code. Please feel free to judge if in your opinion it is the case to update the slide or not.

decltype(x) d1;
decltype(2 + 3.0) d2;
decltype(y) d3 = x;
decltype(z) d4 = z;
decltype(array) d5;
decltype(f(1, 2.0f)) d6();

Slide 32: I tried to compile the code and I got an error message -fpermissive because of missing initialization for const A a; therefore I changed it as const A a{}; Similarly as the previous slide. I was able to comprehend fully the meaning decltype (it returns a type to be used in a subsequent declaration) only when I compiled the following code:

decltype(x) d1;
decltype((x)) d2 = x;
decltype(f) d3;
decltype((f)) g = f;
decltype(a.x) d4;
decltype((a.x)) d5 = x;

image Slide 38: small typo it should be is_null_pointer image Slide 42: small typo missing semicolon ; at the end of the instruction / definitions. it should be std::is_base_of_v instead of std::is_base_v image Slide 44 small typo it should be remove_reference image Thanks Gianmario

jakeheke75 avatar Dec 28 '23 13:12 jakeheke75