Memory management classes. 

Pointer classes.

Because copy has different meaning with different classes, there are several pointer classes here. 
Smart pointers classes. Replace the now obsolete CWizPtr, BaseMultiRefPtr, and MultiRefPtr.(I don't remove them for convenience only). No plain C/C++ pointers again!
File SmartPointers.h defines the following classes: 
CWizSmartPtr - trivial base class for all others; 
CWizSafePtr - smart pointer class which basic garbage collections (i.e. knows to
delete the pointer in destructor). From here and later every pointer class must hold a pointer allocated from heap only! Copy operator attaches the object to the pointer and then detaches it from previous pointer - "pessimistic shadow copy". 
CWizSafeArray - simple array of objects. 
CWizDuplPtr - implements deep copy semantics for copy constructor/operator.
Requires from an object to have a copy constructor. No polymorphism. 
CWizClonePtr - implements deep copy semantics for copy constructor/operator, with support for polymorphism in pointed object. Requires from an object to have a Clone() function. In the case of polymorphism a Clone() function must be virtual function returning pointer to the root of hierarchy.

An example: 
class A 
{ 
A(const A& a); 
virtual A* Clone() const { return new A(*this); } 
}; 

class B 
{ 
B(const B& a); 
virtual A* Clone() const { return new B(*this); } 
}; 

CWizBaseMultiRefPtr - Multiply pointer classes with reference counting and polymorphism.
Class implements basic machinery of reference counting, but doesn't implement a counter. 
Class CWizMultiRefPtr uses int as counter (the simplest solution). 
Implement garbage collection with reference counting, shadow copy, polymorphism. 

CWizCounterMultiRefPtr - optimized Multiply pointer classes with reference counting and polymorphism. Differs from CWizBaseMultiRefPtr in implementing reference counting,which shifted to the managed class itself. It minimizes memory fragmentation, but requires access to the managed classes, which is not always possible. 
  
File SmartPointersSerialize.h defines StoreSmartPtr() and LoadSmartPtr() functions for serializing to/from MFC CArchive. 
File SmartPointerArrays.h defines arrays of smart pointers. All arrays are derived from CArray of MFC. 
File SmartPointerArraysSerialize.h defines template function SerializeArray() for serializing to/from MFC CArchive. 
File SmartPointerArraysSort.h defines template function SerializeArray() for serializing to/from MFC CArchive. 
File SerializeVersion.h defines function SortSmartPrtArray(). 

(Obsolete!) Simple smart pointer class CWizPtr. Intended to replace a pointer.Exception safe and forget-delete proof. Doesn't have copy capabilities!
File SAFE_PTR.H . 
Multiply pointer class with reference counting CWizMultiPtr.
Designed to hold objects of one class (no polymorphism). Several pointers can point to the same object; the object deleted when destroying the last pointer to it. By the nature uses shallow copy. 
File MULTIPTR.H . 
(Obsolete!) Multiply pointer classes with reference counting and polymorphism available.
Template class BaseMultiRefPtr implements basic machinery of reference counting, but doesn't implement a counter. 
Template class MultiRefPtr uses int as counter (the simplest solution). 
Both classes' template parameter DATA intended to be the base class in the hierarchy. 
File MultiRefPtr.H.(Obsolete!) Derived from BaseMultiRefPtr template class LHMultiRefPtr.
Uses class LocalHeapIntCounter, which in turn wrapper for int but is allocated from his own local heap CWizDefaultTypedLocalHeap. 
The most effective multipointer class here. 
Files LHMultiRefPtr.CPP and LHMultiRefPtr.H.

Win32 Memory API Wrappers. 

One size private heap class CWizOneSizeHeap.
I wrote this class for very common situation: when you have to allocate 
many of small objects of the same size; the obvious case is some class widely used in a program. The assumption that all objects on the heap are of the same size allows to minimize allocation overhead to zero. Indeed, every allocation block in the regular heap is preceded by block size. But when the size is known in advance, you could save this place. The technique is simple: the heap manager requests big blocks of the memory from some common heap. Every block of memory is either occupied by allocated object, or points to the next free block. Therefore it manages "in place" linked list of free items without any overhead. The sources are here. 
NB: Feel free to remove inlines if you're more concerned about size then about speed. 
  
Local heap class CWizLocalHeap - wrapper for Win32 API local heap machinery.
Helper class CWizLocalHeapLock useful for locking the heap in the multithreading environment. 
Files LOCALHEP.H and LOCALHEP.CPP . 
Template class CWizTypedLocalHeap derived from CWizLocalHeap to avoid mess with local heap parameters.
Class CWizDefaultTypedLocalHeap derived from CWizTypedLocalHeap and supplies reasonable default parameters. 
Define DECLARE_LOCAL_HEAP forces objects of any class to be allocated from it's own private local heap. Very useful in new-intensive algorithms. 
Files TypedLocalHeap.CPP and TypedLocalHeap.H . 
Virtual memory class CWizVirtualMemory - wrapper for Win32 API virtual memory machinery. 
Derived template class CWizTypedVMem to be used as virtual array. 
Files VIRT_MEM.H and VIRT_MEM.CPP . 
Memory mapped file wrappers: 
CWizFileMapping - kind of file mapping wrapper. 
CWizFileMapView - view of this mapping (actual memory address). 
template <class TYPE> class CWizFileView - kind of "virtual array" mirroring a file. 
template <class TYPE> class CWizROFileView - read-only view (virtual array) of an existing file. 
CWizFullFileView - read/write file mapping. Uses CWizTempFileStrategy for managing temporary files. 
template <class TYPE> class CWizTypedFullFileView - typed derivative of CWizFullFileView. 
Files FILE_MAP.H and FILE_MAP.CPP . 

CWizFileROFileMapping - implements "windowed" view to memory mapping.Useful when address space is low or when access to the file is rare.
Nested class Window acts like actual window to the mapping and moves itself by demand. 
This class has template parameter LOCKER which implements multithreading synchronization for Window objects. Two classes supplied for this: 
CWizFileMapNoLocker - no locking and synchronization. Useful when: 
a) only single thread accesses the view or 
b) another synchronization implemented in your application or 
c) you are absolutely sure it's no need for synchronization. 

CWizFileMapCritSectLocker - uses critical section for synchronization between threads. 
Please note that synchronization is managed only when retrieving the view from memory mapping. Every view supposed to be thread-specific or at protected by another way. 

template<class LOCKER, class DATA> class CWizTypedFileROFileMapping -
typed derivative of CWizFileROFileMapping (like virtual array of structs). 
Because of strange compilation errors -:) the nested class is called Wnd instead of Window. 
Files FileMapWindow.H and FileMapWindow.CPP .

