It was found that dynamic exception specifications were not really useful, which is why they've been deprecated in C++11. The only case where they were deemed useful were empty dynamic exception specification, that is throw()
. For this case, the noexcept
declaration was introduced as a better alternative, allowing the compiler to perform more aggressive optimizations. (Note that this means that throw()
and noexcept
are not semantically equivalent and you should only replace the former with the latter if you know that the program will still behave correctly.)
In your case, you don't have an empty throw()
so you cannot replace it with noexcept
. It is widely agreed upon that in this case, it would be best to simply remove the throw(std::runtime_error)
and mention the fact that the function might throw a std::runtime_error
but nothing else in the documentation, as Yakk has already suggested in the comments.