RAII is convenient in C++.
Essentially, it is the trick of using the destructor to do something like arrange flr printing of a data structure.
Essentially, it is a trivial form of introspection.Practically the only way in C++ than you can automatically traverse a type, and al of its members.
Today, I would like to automatically create a print function. I am tempted to use RAII, so that it gets printed at destruction. That seems silly, however; but it is the only way I know to autromatically call a method on all members.
No comments:
Post a Comment