proper implementation of get_terminate/get_unexpected, based on Apple's libstdc++