Is it a good idea to log output to a file in a C++ class destructor? My use case is a simulator where I have a logging class that logs to an in-memory data structure and then dumps it all into a file when it is destructed.
This is similar to the question here (C# class: Do logging / housekeeping, should I use a destructor?), but my question deals with standard non garbage-collected C++, not C#.