2

I am currently working on a custom stack allocator. This allocator has a list of all allocated objects so that it can call the destructors of each object, once a deallocate method is called. However, I was wondering if every destructor of every type always has to get called or if there are types that don't need a destructor call.

I already found std::is_trivially_destructible, but I am not quite sure if it does what I think it does. I think if std::is_trivially_destructible() is true, then the destructor does not need to be called. Is this true?

Brotcrunsher
  • 767
  • 4
  • 19
  • The top answer on this question will probably have your answer: http://stackoverflow.com/questions/6500313/why-should-c-programmers-minimize-use-of-new?rq=1 – StackAttack May 07 '17 at 01:20
  • 1
    @StackAttack that answer is about allocation/deallocation of memory and not construction/destruction (e.g. calling ctors/dtors) – Pavel P May 07 '17 at 01:25

0 Answers0