On 5/1/2014 5:43 PM, Andrei Alexandrescu wrote:
For example, we have a File struct. It is entirely legitimate for someone to want to keep a File member variable in a class object. They take care of opening and closing it appropriately. Again, this is 100% legit code to want to write. Coming to them from the perspective "you are doing it wrong and there is no recourse for achieving what you need to do" strikes me as odd.
I meant from the perspective of expecting the GC to close the file for you. If you manually run the destructor, such as from using delete, that wouldn't be a problem.