If the real participation reference parameters do not match, C ++ will generate temporary variables. If reference parameters are const, the compiler generates temporary variables in the following two cases:
1. The argument type is correct, but not the value of the left
2. argument type is not correct, but can be converted to the correct type
Refcube double (const Double & RA) {
Returnra * RA * RA;
}
Double Side = 3.0;
Double Side * PD = &;
Double & RD = Side;
Long Edge = 5L;
Double Lens [. 4] = {2.3,3.4,4.5,6.7 };
Double refcube C1 = (Side); // RA is a Side
Double refcube C2 = (Lens [2]); // RA is Lens [2]
Double refcube = C3 (RD); // RA is RD
Double C4 = refcube (* pd); // ra is PD *
Double C5 = refcube (Edge); // temporary variables RA is
double c6 = refcube (7.0); // ra temporary variable
double c7 = refcube (side + 10.0 ); // ra temporary variables
Reprinted from https://blog.csdn.net/yusiguyuan/article/details/43526039