Home > Back-end >  [the decltype basic understanding the problem]
[the decltype basic understanding the problem]

Time:03-28

Here said the expression is not used if the decltype variables, it returns the result of the expression type, the last line of p solutions reference of type int, isn't it? Why is int&

CodePudding user response:

Simple said is,
C + + 11 provisions above the decltype (e) has four derivation principle, concrete can have a look at the deep understanding of the c + + 11. In turn is derived according to the four order,
His third rule if e is an lvalue, of type T, the derived type is T&

CodePudding user response:


He is judgment in order these four, the first is without parentheses markers, such as
int a;
The decltype c (a);//this is int
Then if death value, it deduces T& &
Then the left value, as T& Derivation,,,,

CodePudding user response:

refer to the second floor truth is right or wrong response:

He is judgment in order these four, the first is without parentheses markers, such as
int a;
The decltype c (a);//this is int
Then if death value, it deduces T& &
Then the left value, as T& Derivation,,,,

I see! thank you
  • Related