#include "wx/string.h"
   #include "wx/intl.h"
 #if wxUSE_THREADS
-  #include <wx/thread.h>
+  #include "wx/thread.h"
 #endif
 #endif
 
   return is;
 }
 
+ostream& operator<<(ostream& os, const wxString& str)
+{
+  os << str.c_str();
+  return os;
+}
+
 #endif  //std::string compatibility
 
 // ----------------------------------------------------------------------------
 }
 
 // add item at the end
-void wxArrayString::Add(const wxString& str)
+size_t wxArrayString::Add(const wxString& str)
 {
   if ( m_autoSort ) {
     // insert the string at the correct position to keep the array sorted
     wxASSERT_MSG( lo == hi, wxT("binary search broken") );
 
     Insert(str, lo);
+
+    return (size_t)lo;
   }
   else {
     wxASSERT( str.GetStringData()->IsValid() );
     str.GetStringData()->Lock();
 
     // just append
-    m_pItems[m_nCount++] = (wxChar *)str.c_str();
+    m_pItems[m_nCount] = (wxChar *)str.c_str(); // const_cast
+
+    return m_nCount++;
   }
 }
 
 {
   wxASSERT( str.GetStringData()->IsValid() );
 
-  wxCHECK_RET( !m_autoSort, wxT("can't use this method with sorted arrays") );
-
   wxCHECK_RET( nIndex <= m_nCount, wxT("bad index in wxArrayString::Insert") );
 
   Grow();