Why is default_delete's operator() not declared noexcept?

Hi,

Since destructors should never throw (are assumed noexcept even if not specified as such), why is

operator()(T*p) const

from

class default_delete

not declared noexcept?

Thanks,
Juan
Maybe because more than a destructor may be called? In other words, the deleter is not only (not always) related to memory -- it can other resources which upon closing could throw??
Since destructors should never throw (are assumed noexcept even if not specified as such), why is

Two issues here. "Should not" is not "cannot."

The parenthetical assumption is only true in certain circumstances, mainly that a destructor does not call a function that is not specified as noexcept(false) and they are not themselves specified as noexcept(false).
Last edited on
Topic archived. No new replies allowed.