I'm writing my own container that requires nothrow movable and copyable types. I thought I could simplify logic a bit when it comes to exception safety. But I noticed that construct
and destroy
member functions of allocators have no wording about when they can and can't throw exceptions.
I'm pretty sure I've read the wording before. Otherwise, even if my type is nothrow movable, construct
can still throw an exception from user-provided allocator when, say, I resize the buffer to increase capacity. This requires complex rollback code to guarantee strong exception safety that I really wanted to skip.
Is there a wording that allows to only throw exceptions from calling ctor/dtor or are allocators always require complex machinery to maintain exception safety?