const is a separate throw () problem.
This means that it is a const method. Thus, calling this method will not change the state of the object.
throw () means that the method will not throw any exceptions.
In the USER of this method, the method will only return in the normal way, and you do not need to worry about the exceptions that cause the call.
The IMPLEMENTER method is more worried.
Unlike Java, this is not a compilation time limit, but a run-time limit. If the executor writes this function so that it accidentally throws an exception to the method, then the execution time will stop the application dead (without expanding the stack without destructors, etc.).
But the agreement is that the developer will take extra precautions to catch all the internal exceptions.
PS
You can get from std :: runtime_error
(From Comment@onebyone.livejournal.com ): Not really.
The no throw specifier is actively used. This exception safety measure indicates that the method provides a no-throw guarantee.
On the other hand, other exception specifiers are not used because they are too dangerous. If you make a mistake, this will lead to the termination of the application via (std :: unexpected). The default action is to terminate the application without unwinding the stack and without cleaning it using object destructors. In MHOP, this is hardly desirable.
source share