Binding temporaries to non-const references in case of exceptions
问题 I have always read that temporaries are allowed to bind only with non-const reference arguments in case of function calls.. CASE 1:- For example:- class Simple{ public: int i; Simple(Simple &f) { i = f.i + 1; } Simple(int j) { i = j; } }; int main() { Simple f1 = Simple(2); // error no matching call fruit::fruit(fruit)... return 0; } This would give me error as I am trying to bind temporary with non-const reference arguments. CASE 2:- try { throw e; } catch ( exception& e ) { } I have learnt