Is it safe to use the throw() suffix on a function containing std::string?
c++, exception, std, stdstring
Solution
Herb Sutter says that
exception specifications confer a lot less benefit than they're worth
It can cause more problems than bring benefits. So, you should think twise before doing that.
Problem
I have a member function that doesn't throw anything so i appended the `throw()` suffix to the end of it, indicating that it won't throw any exceptions. My question is, in the function I make use of several `std::string`, and lets say something goes wrong in the initialization of the `std::string`, and it throws `bad_alloc` or `out_of_range` (or what ever else can go wrong with a std::string). Is it still safe to still add the `throw()` suffix?