So I wanted to improve the noexcept of some operators and functions in my code
can I mark this function no except?
std::string remove_suffix(std::string s)
/*noexcept*/
// is noexcept allowed here?
{
if(s[s.size()-1] == '0')
s[0] = 'B';
else
s[0] = 'X';
return s;
}
can i mark this function noexcept and if it happens to throw an exception will it call ‘std::terminate’
I want to make sure of this so I can mark my addition operators for one my classes as noexcept to correct
New contributor
user24551355 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.