I'm writing a little program in C++11 and really use exceptions for one of the first time.
I've got a question about how to catch the exceptions efficiently, and after some googling I still don't have the answer.
Here is the question : What is the more efficient (or recommended) between catching the exception by (const?) lvalue reference, or by (const?) rvalue reference?
In code this give :
1)
try { throw std::exception{"what"}; }
catch (std::exception& ex) {}
2)
try { throw std::exception{"what"}; }
catch (const std::exception& ex) {}
3)
try { throw std::exception{"what"}; }
catch (std::exception&& ex) {}
4)
try { throw std::exception{"what"}; }
catch (const std::exception&& ex) {}