The website sometimes fudges things with somewhat-incorrect statements. Maybe it's a minor issue, but I noticed that it says, for example:
> When an initializer is provided after an equals sign, this is called copy
> initialization. Copy initialization was inherited from the C language.
>
> int width = 5; // copy initialization of value 5 into variable width
>
That's not quite right. Consider the following program:
#include <iostream>
struct A {
A (const A& other) : x{other.x} { std::cout << "Copy ctor\n" ;}
A (A&& other) : x{other.x} { std::cout << "Move ctor\n" ;}
A() : x{0} { std::cout << "Default ctor\n" ;}
A(int x_) : x{x_} { std::cout << "int ctor\n" ;}
A& operator=(const A& other) { x = other.x; std::cout << "Copy assignment\n" ; return *this; }
A& operator=(A&& other) { x = other.x; std::cout << "Move assignment\n" ; return *this; }
int x;
};
int main() { A a1 = A(5); }
The constructor used here will not be the copy constructor. There will be just a single construction, of a1, and it will be the "int ctor", i.e. `A(int x_)`.See it on GodBolt : https://godbolt.org/z/eT8soWMxE
I don't know if this characterizes other parts of LearnCPP, haven't gone through it myself.