Q. Why we use explicit type casting with STL min function (i.e. charCount = min((size_t) nc, mSizeTable[p]);)?
A. STL min requires arguments of the same type. Variable nc (translates as "number of characters") is defined as signed long, yet size table is vector of size_t.
Q. Why wrapper classes (CCharWrap, CCStrWrap, CPStrWrap) use input of type void*?
A. This allow to avoid explicit pointer conversion, since different compiler may treat sequences like "c style string" as char* or as unsigned char*. For example, typical Macintosh C++ compiler will recognize "c style string" (C NULL terminated string) as char*, but "\ppascal style string" (Pascal string with first item indicating length, where prefix "\p" instructs compiler to generate such item) as unsigned char*, what is not the same.
Q. Why many function members use scope resolution operator (i.e. CDynGenStrArray::Insert(i1, i2, p); or CRefDynGenStrArray::Insert(v, mSize);)?
A. Without scope resolution operator many functions will run into endless loop. For example, main Insert() function members of CRefDynGenStrArray call PushBack() of CDynGenStrArray. Without proper scope resolution they will call PushBack() of CRefDynGenStrArray, which, in turn, again calls Insert() of CRefDynGenStrArray.
Q. What is the purpose of macro FRIEND_CLASS_CREFDYNGENSTRARRAY?
A. This macro allows you to add your own friend
classes to CRefDynGenStrArray
without changes in its interface. Just add these lines before #include
Direct access from non-derived (and derived, too) classes to protected members of CRefDynGenStrArray is not encouraged, but sometimes might be necessary. Just make sure you know what are you doing.
Q. What are the most recent changes in CRefDynGenStrArray?
A. Look in CRefDynGenStrArray Version History.