From 31222b7cfa9aedad2a4d39e5fdafa540eb4c7c79 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 11 Jul 2003 19:33:10 +0000 Subject: [PATCH] fixed using arrays as nested classes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21896 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dynarray.h | 45 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index b022b49a9c..3228aee579 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -350,10 +350,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 +382,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 +446,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 -- 2.45.2