Home > Back-end > Transition initialization what's going on?
Transition initialization what's going on?
Time:12-03
Copy the initialization is to use an equal sign initialize an lvalue method:
A, A. A, b=A.
B is actually calls the copy constructor created objects, There is a kind of implicit type conversion characteristics, called conversion constructors, condition was introduced into a single class has a need arguments constructor, will allow a parameter of type conversion to a class type:
# include using namespace std; Class A { Public: (A)=default; {A (int A) cout<" A (int) called "& lt; A (const A& A); ~ (A) {cout<" ~ (A) called "& lt; }; A: : A (const A& A) { cout<" A (const A&) Called "& lt; } Int main () { A, A=1. }
G + + compiler and MSVC compiler (vs2017) seems to have different treatment methods, First compiled using g + +, use the parameter - fno - elide - constructors to cancel return value optimization, enter the following: