Re: how to organize several class and their instance in windows programming
"asm23" <asmwarrior@gmail.com> ha scritto nel messaggio
news:g16g3j$2ak$2@aioe.org...
Thanks again, though I have heard a little about "smart pointer", I should
search some tutorials to learn it.
Smart pointers can give a productivity boost in C++ development, giving to
C++ programmers a kind of "managed heap" or "garbage collector" like C# and
..NET.
Actually, some smart pointer classes (like shared_ptr) are better than .NET
garbage collector, because garbage collector is non-deterministic, and is
good for memory resources only (garbage collector is not good for non-memory
resources, like textures, sockets, file handles... you must implement the
"dispose" pattern for them in C#...).
Instead, shared_ptr is deterministic (i.e. in the point in time that the
reference count of the pointed object becomes 0, the object is immediately
destructed, and its resource released), and shared_ptr is good also for
non-memory resources.
There's a video on Channel 9 by a bright member of VC++ Team: Stephan 'STL':