Answer the question
In order to leave comments, you need to log in
When will const, an alias in a function, be removed?
Good afternoon!
void func(int&); //Увеличить на 1 входящее значение
//...
func(1); //Попытка инициализировать ссылку, которая сразу же станет "битой"
void func(const int&); //Увеличить на 1 входящее значение
const double& d = 1;
Answer the question
In order to leave comments, you need to log in
This feature is called extending the life of temporary objects when they initialize a constant reference.
Details: https://herbsutter.com/2008/01/01/gotw-88-a-candid...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question