Container Semantic Classes
SimpleLib's container classes support a concept of semantics that can be used to control things such as ownership of contained object and sorting rules. For example a typical vector of object pointers can be declared like this:
CVector<CMyObject*> vec;
However to have these objects owned by the collection and automatically deleted when removed from the collection (or when the collection is destroyed), use this:
CVector<CMyObject*, SOwnedPtr> vec;
or reference counted objects (eg: COM interface pointers):
CVector<CMyObject*, SRefCountedPtr> vec;
Semantics classes can also used to control case sensitivity. For example a case sensitive map of strings to ints:
CMap<CString<char>, int> map;
To make the map case insensitive:
CMap<CString<char>, int, SCaseInsenstive> map;
A map of case sensitive strings to owned object pointers:
CMap<CString<char>, CMyObject*, SCaseInsensitive, SOwnedPtr> map;