]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dynarray.h
Added RTL functions missing from WinCE to wxchar.h/cpp
[wxWidgets.git] / include / wx / dynarray.h
index c1d42f59f358fb64b53dfda616c9b404cd150cbe..b836cffb729ffea5e3a7d320cb64e81788401305 100644 (file)
@@ -24,9 +24,6 @@
     #include <vector>
     #include <algorithm>
     #include "wx/afterstd.h"
-    #if defined(__WXMSW__) && defined(__MINGW32__)
-        #include "wx/msw/winundef.h"
-    #endif
 #endif
 
 /*
@@ -114,7 +111,7 @@ protected:                                                          \
   size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const;          \
   void Add(T lItem, size_t nInsert = 1)                             \
     { insert(end(), nInsert, lItem); }                              \
-  void Add(T lItem, CMPFUNC fnCompare);                             \
+  size_t Add(T lItem, CMPFUNC fnCompare);                           \
   void Insert(T lItem, size_t uiIndex, size_t nInsert = 1)          \
     { insert(begin() + uiIndex, nInsert, lItem); }                  \
   void Remove(T lItem);                                             \
@@ -170,7 +167,7 @@ protected:                                                          \
   int Index(T lItem, CMPFUNC fnCompare) const;                      \
   size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const;          \
   void Add(T lItem, size_t nInsert = 1);                            \
-  void Add(T lItem, CMPFUNC fnCompare);                             \
+  size_t Add(T lItem, CMPFUNC fnCompare);                           \
   void Insert(T lItem, size_t uiIndex, size_t nInsert = 1);         \
   void Remove(T lItem);                                             \
   void RemoveAt(size_t uiIndex, size_t nRemove = 1);                \
@@ -350,10 +347,16 @@ public:                                                               \
     typedef value_type& reference;                                    \
     typedef value_type* pointer;                                      \
     typedef reverse_iterator itor;                                    \
-    friend itor operator+(int o, const itor& it);                     \
-    friend itor operator+(const itor& it, int o);                     \
-    friend itor operator-(const itor& it, int o);                     \
-    friend difference_type operator -(const itor& i1, const itor& i2);\
+    friend inline itor operator+(int o, const itor& it)               \
+        { return it.m_ptr - o; }                                      \
+    friend inline itor operator+(const itor& it, int o)               \
+        { return it.m_ptr - o; }                                      \
+    friend inline itor operator-(const itor& it, int o)               \
+        { return it.m_ptr + o; }                                      \
+    friend inline difference_type operator-(const itor& i1,           \
+                                            const itor& i2)           \
+        { return i1.m_ptr - i2.m_ptr; }                               \
+                                                                      \
   public:                                                             \
     pointer m_ptr;                                                    \
     reverse_iterator() : m_ptr(NULL) { }                              \
@@ -376,10 +379,16 @@ public:                                                               \
     typedef const value_type& reference;                              \
     typedef const value_type* pointer;                                \
     typedef const_reverse_iterator itor;                              \
-    friend itor operator+(int o, const itor& it);                     \
-    friend itor operator+(const itor& it, int o);                     \
-    friend itor operator-(const itor& it, int o);                     \
-    friend difference_type operator -(const itor& i1, const itor& i2);\
+    friend inline itor operator+(int o, const itor& it)               \
+        { return it.m_ptr - o; }                                      \
+    friend inline itor operator+(const itor& it, int o)               \
+        { return it.m_ptr - o; }                                      \
+    friend inline itor operator-(const itor& it, int o)               \
+        { return it.m_ptr + o; }                                      \
+    friend inline difference_type operator-(const itor& i1,           \
+                                            const itor& i2)           \
+        { return i1.m_ptr - i2.m_ptr; }                               \
+                                                                      \
   public:                                                             \
     pointer m_ptr;                                                    \
     const_reverse_iterator() : m_ptr(NULL) { }                        \
@@ -434,21 +443,8 @@ public:                                                               \
   void reserve(size_type n) { base::reserve(n); };                    \
   void resize(size_type n, value_type v = value_type());              \
   size_type size() const { return base::size(); }                     \
-};                                                                    \
-                                                                      \
-inline name::reverse_iterator operator+(int o, const name::reverse_iterator& it) { return it.m_ptr - o; } \
-inline name::reverse_iterator operator+(const name::reverse_iterator& it, int o) { return it.m_ptr - o; } \
-inline name::reverse_iterator operator-(const name::reverse_iterator& it, int o) { return it.m_ptr + o; } \
-inline name::difference_type operator -(const name::reverse_iterator& i1, \
-                             const name::reverse_iterator& i2)            \
-    { return i1.m_ptr - i2.m_ptr; }                                       \
-                                                                      \
-inline name::const_reverse_iterator operator+(int o, const name::const_reverse_iterator& it) { return it.m_ptr - o; } \
-inline name::const_reverse_iterator operator+(const name::const_reverse_iterator& it, int o) { return it.m_ptr - o; } \
-inline name::const_reverse_iterator operator-(const name::const_reverse_iterator& it, int o) { return it.m_ptr + o; } \
-inline name::difference_type operator -(const name::const_reverse_iterator& i1,\
-                             const name::const_reverse_iterator& i2)      \
-    { return i1.m_ptr - i2.m_ptr; }                                       \
+}
+
 
 #endif // !wxUSE_STL
 
@@ -458,7 +454,7 @@ inline name::difference_type operator -(const name::const_reverse_iterator& i1,\
 // ----------------------------------------------------------------------------
 
 #define _WX_DEFINE_SORTED_TYPEARRAY_2(T, name, base, defcomp, classexp, comptype)\
-wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(void *),                   \
+wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(base::base_type),          \
                        TypeTooBigToBeStoredInSorted##base,            \
                        name);                                         \
 classexp name : public base                                           \
@@ -488,8 +484,8 @@ public:                                                               \
   void AddAt(T item, size_t index)                                    \
     { base::insert(begin() + index, item); }                          \
                                                                       \
-  void Add(T Item)                                                    \
-    { base::Add(Item, (CMPFUNC)m_fnCompare); }                        \
+  size_t Add(T Item)                                                  \
+    { return base::Add(Item, (CMPFUNC)m_fnCompare); }                 \
                                                                       \
   void RemoveAt(size_t uiIndex, size_t nRemove = 1)                   \
     { base::erase(begin() + uiIndex, begin() + uiIndex + nRemove); }  \