Giter VIP home page Giter VIP logo

modern-cpp-programming's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modern-cpp-programming's Issues

Typo in 'A Little History of C++'

01.Introduction.pdf; page 11.

'The lag of these things formed the reason...' should read 'The lack of these things formed the reason...'.

[Typo] 09.Templates_I.pdf

Hello Federico,
I have a doubt about page 10. This specific slide is explaining the difference between Implicit and Explicit Template Instantiation.
The last row is showing instruction template f<int>(int);
But the explicit template instantiation shouldn't be for instance f<int>(3);?
Because the instruction template f<int>(int); it seems a template specialization, something like:

template<>
void f<int>(int); 

I apologize in advance if I misunderstood the meaning of the slide, but I am the perfect "dumb user" since I am learning C++ from your course without any previous experience 😄
Thanks,
Gianmario
image

[Typo] 07.Object_Oriented_I.pdf

Hello,
A small typo that we can remove at page 41 where the semicolon after the braces is not needed.
Not sure if I am missing something, maybe we can also remove the comment near to function call g() because here the copy constructor is not called.
image
Thanks.

Warn that 'using namespace std' is a bad practice

It is understandable that 'using namespace std' is used for educational reasons, but then I think it should be pointed out somewhere in the text that it is done for that reason, but is currently considered bad practice in any style guide.

[Typo] 08.Object_Oriented_II.pdf

Hello,
If I am not wrong at page 26 data member int var has not been initialized, so it will not print 3 but an undefined int value:
image
Thanks.

Possible logic error in Floating-point Comparison function

In 02.Basic_Concepts_I.pdf, on slide 94 inside the function areFloatNearlyEqual there is the following code for catching Inf or NaN arguments:

if (std::isfinite(a) || isfinite(b))  // a = ±∞, b = ±∞ and NaN
        return false;

But it was causing the function to return false always, even for finite values. I think it should be:

if (!(std::isfinite(a) && std::isfinite(b)))  // a = ±∞, b = ±∞ and NaN
        return false;

[Typo] 09.Templates_I.pdf

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

Typo report in 07.Object_Oriented_II.pdf

Hi Federico,

Just spotted another little typo. :-)
On Page 48/61 in in 07.Object_Oriented_II.pdf, you might want "y.Array" to be "y.array".
By the way, I really like your idea of making a copy and swapping it with the current object.

Thanks a bunch once again.
Wishing you a cozy weekend.

Kind regards,
Soohwan

About the correction of books

In 03 Basic Concepts: IEEE Floating-Point Standard, I found that there are some statements that describe the IEEE764 standard, but it should actually be IEEE754.

Chapter 2, Page 39: i = 3, should be 2

In chapter 2, on page 39, the second example reads:

i = 0;
i = i++ + 2; // until C++17: undefined behavior
             // since C++17: i = 3

I believe i = 2. GCC 11.4.0 seems to agree:

$ cat test.cpp
#include <iostream>

int main() {
        int i = 0;
        i = ++i + 2;
        std::cout << i << "\n";
        i = 0;
        i = i++ + 2;
        std::cout << i << "\n";
}
$ g++ -std=c++17 test.cpp
$ ./a.out 
3
2

I got the same behavior with -std=c++20 and -std=c++23.

[Typo] 09.Templates_I.pdf

Hi Federico,
Not sure if I have eaten too much, I have a couple of doubts at page 15:

  • Return type of the function print1 should be void
  • Default values must be specified at the end of the parameters list only for primary class templates, primary variable template or alias template as explained here. Since here we have a function template there is no compile error for instruction template<int A = 3, int B>
    image
    Thanks,
    Gianmario

Basic Concepts V Typo

6. Basic Concepts V, section "Common Error 1", page 40/61

The comment // 'value' disapear should be corrected to // 'value' disappears.

New men

Name hasnain Ahmed
New Web development
Plz come work with together

what is the font used in the examples

Hey, Sorry if this is not the right place to do this. But i am very curious about the the font you have used in the examples in the pdf.
Reference on Page 12 in Indtroduction.pdf.

Possible error in Capture List and Classes

Dear Federico,

perhaps an error in 05.Basic_Concepts_IV.pdf slide 33.

auto lambda3 = [this]() { return data; }; // copy by-reference, return 2

it returns 1, not 2.
For instance, the following prints 1 with -std=c++20:

#include <iostream>

class A {
    public:
        int data = 1;

        void f(){
            int var = 2;
            auto lambda3 = [this](){return data;};
            std::cout<<lambda3()<<std::endl;
        }
};   

int main(){
    A a;
    a.f();
    return 0;
}

[Typo] 08.Object_Oriented_II.pdf

Hello,
If I am not wrong at page 29 in the definition of member function f() it is missing the void return type.
The last instruction should print 1B because of implicit upcasting.
image
Thanks.

Typo: Table of Context

The words should be "Table of Contents" not "Table of Context." You're literally presenting a table (i.e., listing) of the contents. This error seems to appear in all the chapters, unfortunately.

C++ Journey

#include
using namespace std;

int main(){
cout >> " Hello World" >> endl;
return 0;
}

Fixes in Iterators Containers

Hi Federico, I think there are some errors in the Iterators Containers slides.

  • Page 19 (std::array):
    • #include <algorithm> is missing; without it we cannot use std::sort
    • arr1 and arr2 need to be of the same size, otherwise operator> won't work
    • missing ; at the end of the last line of code
  • Page 20 (std::vector):
    • vec5.fill(3) does not work, since std::vector does not have such a method. Instead, std::fill(vec5.begin(), vec5.end(), 3) can be used
    • when it prints the elements in vec1, the comment is 2, 3, 5, but I believe it should be 2, 3, 4
  • Page 21 (std::list):
    • list5.fill(3) needs to be changed to std::fill(list5.begin(), list5.end(), 3)
    • list1.merge(arr5): I believe it should be list1.merge(list5)
      • merge() does not work as expected, since both lists should be sorted. Moreover, I think the comments after that are not correct, as they use the result of the merge as a starting point (for example I got [2, 3, 2, 3, 3, 5] instead of [2, 3, 2, 5, 3, 3])
  • Page 22 (std::deque):
    • queue5.fill(3) to std::fill(queue5.begin(), queue5.end(), 3)
  • Page 23 (std::forward_list):
    • flist5.fill(4) to std::fill(flist5.begin(), flist5.end(), 4)
    • flist1.erase_after(flist1.begin(), 0) does not compile
    • when merge() is called, both list should be sorted
  • Page 30 (std::multiset):
    • #include <multiset> should be changed to #include <set>
    • when declaring mset2 the comment says empty map (it should say multiset/set)
    • *(it + 1) does not compile (maybe *(++it) can be used?)
      • during my tests that line prints 6 and 5, not 5 and 5 as the comment indicates, but I don't understand why. Maybe I am missing something
  • Page 33 (std::priority_queue):
    • the last block of code does queue1.push(5); queue1.push(4);; but probably it should be pqueue1.push(5); pqueue1.push(4);

I hope everything is clear and I didn't make any silly mistakes!

Type Deduction - Pass by-Value

At 18.Advanced_Topics_I.pdf, slide 45, the last 2 lines should be:

    f(y); // T = const int*
    f(z); // T = int* !! (const drop)

image

[Typo] 07.Object_Oriented_I.pdf

Hello,
At page 28 of 07.Object_Oriented_I.pdf maybe the constructor should be ArrayWrapper instead of A or I am missing something?
image
Thanks

[Typo] 05.Basic_Concepts_IV.pdf

Hello Federico,
First of all thank you for this course.
If I am not wrong there is a small typo at page 38 of 05.Basic_Concepts_IV.pdf, "Deferencing" instead of "Dereferencing"
image
Thanks,
Gianmario

Another typo in 07.Object_Oriented_II.pdf

Hi Federico,

Hope I'm not bothering you.

I spotted what might be another typo on Page 33/61 in 07.Object_Oriented_II.pdf.
When you return the Point object from the operator+, it seems like you intended to return {x + p.x, y + p.y} instead of {x + p.x, y + p.x}.

Time is flying, and it's getting pretty chilly here in South Korea.
Wishing you a fantastic end to the year season.

Kind regards,
Soohwan

Permission to Use and Customize Course Material

Hey federico,

Hope this finds you well! 👋 Your C++ course repo is a goldmine, seriously. 🚀 I'm in the process of putting together a university course on C++, and I'd love to use and tweak the material for my slides.

Your coverage of all the topics is spot-on, and I think it'll be a game-changer for my students.

I noticed there's no license file, so I wanted to check with you. I'll, of course, give full credit and add a link back to your repo.

If you're cool with it or have any conditions, just hit me up. Your work is top-notch, and I want to make sure I'm on the right side of things.

Cheers!

Chapter 3, page 50: Was "/" meant where "\" is?

In chapter 3, page 50, this line appears:

op ∈ {+, −, *, \} denotes exact precision operations

Where \ appears, was / intended? I think op is intended to be the set of basic mathematical operations: add, subtract, multiply, divide. In that case, I'd expected / to be used for division instead \.

[FEAT REQ] epub version

Hi, could it be possible to generate an epub version of each pdf ()or combined) so they can be sent to ebook readers (like Kindle) and take advantages of the extra features of those over plain PDFs, like change font size, etc?

I know there are pdf to epub converters but they arent very good and it would be better to convert from whatever your original source material is.

Thanks.

Char type one's complement?

Hello Federico,

In the document 02.Basic_Concepts_I.pdf, on slide 18/100, you have written that char is a one's complement type with a range from -127 to 127, and I believe this is incorrect. The range could be either the same as signed char or unsigned char, depending on the platform. For example, the range with x86 processors is -128 to 127 (example here: https://godbolt.org/z/G9MYbhGfd). On ARM processors, it is from 0 to 255.

Best regards,
Marco

Typo in 07.Object_Oriented_I.pdf

07.Object_Oriented_I.pdf::slide_7:

-The resource is automatically *releases* when the object gets out of scope (destructor)
+The resource is automatically *released* when the object gets out of scope (destructor)

[Typo] 08.Object_Oriented_II.pdf

Hello Federico,
At page 62 small typo, it should be std::is_trivially_copyable as shown above.
Small observation also, please feel free to decide if it is worth mentioning or not: in C++20 std::is_pod has been deprecated.
Thanks,
Gianmario
image

Typos in 05.Basic_Concepts_IV.pdf

Hi Federico,

Thanks you very much for sharing your slides.
I found some typos in 05.Basic_Concepts_IV.pdf.

  1. Page 5
    The comment "// linking error "f" ist not defined" in the last line should be "// linking error "g" is not defined"

  2. Page 32
    First, I think "std::is_is_arithmetic" should be "std::is_arithmetic". "is_is" must be a typo.
    Second, I'm not an expert on the "requires" keyword, but should it be "std::is_arithmetic_v"?

Hope this helpful.
Thanks again.

Kind regards,
Soohwan

[Typo] 0.5Basic_Concepts_IV

On page 54, "const Keywords and Pointers", the word "refereed" appears in each of the bullet points.

I believe it should be "referred"!

Typo in 07.Object_Oriented_II.pdf

Hi Federico,

Hope you're doing well.
I think I found another typo. :-)

In the second option on Page 47/61 in 07.Object_Oriented_II.pdf,
I think "swap(this, x);" should be "swap(*this, x);".
The declaration in the next page says "void swap(A& x, A&y);"
and thus instead of passing the this pointer, I think we need to pass the object after dereferencing.

Hope this helpful for improving your work.
Thank you very much again.

Kind regards,
Soohwan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.