From what I gathered, it depends on the implementation of the constructors and destructors for user-defined data types.
I was wondering if there is set time complexity / any guarantees for primitive data types allocation?
CodePudding user response:
No, there's no such guarantee. Lacking constructors, the time complexity is entirely due to the underlying operator new
which has to find free heap storage.
Note that some operator new
call is also needed for classes, but this could be either the global ::operator new
or a class member. In both cases, it too needs to find free heap storage.