// lock/unlock
void Lock() { if ( !IsEmpty() ) nRefs++; }
- // VC++ will refuse to inline this function but profiling shows that it
- // is wrong
+ // VC++ will refuse to inline Unlock but profiling shows that it is wrong
#if defined(__VISUALC__) && (__VISUALC__ >= 1200)
__forceinline
#endif
+ // VC++ free must take place in same DLL as allocation when using non dll
+ // run-time library (e.g. Multithreaded instead of Multithreaded DLL)
+#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL)
+ void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); }
+ // we must not inline deallocation since allocation is not inlined
+ void Free();
+#else
void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); }
+#endif
// if we had taken control over string memory (GetWriteBuf), it's
// intentionally put in invalid state
bool AssignCopy(size_t, const wxChar *);
// append a (sub)string
- bool ConcatSelf(int nLen, const wxChar *src);
+ bool ConcatSelf(size_t nLen, const wxChar *src);
// functions called before writing to the string: they copy it if there
// are other references to our data (should be the only owner when writing)
// standard types
typedef wxChar value_type;
+ typedef size_t size_type;
+ typedef value_type *iterator;
typedef const value_type *const_iterator;
// an 'invalid' value for string index
// position one after the last valid one
const_iterator end() const { return wx_str() + length(); }
+ // first valid index position
+ iterator begin() { CopyBeforeWrite(); return m_pchData; }
+ // position one after the last valid one
+ iterator end() { CopyBeforeWrite(); return m_pchData + length(); }
+
// lib.string.modifiers
// append a string
wxString& append(const wxString& str)