Commit Graph

59 Commits

Author SHA1 Message Date
Vadim Zeitlin
4a8e979925 Add ctor and assign() taking an iterator range to wxVector<>.
Do it for consistency with wxArray and std::vector<>, even if the current
implementation is suboptimal.

See #15216.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74045 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-05-22 14:13:26 +00:00
Vadim Zeitlin
f7ef20685f Add wxVector<>::const_reverse_iterator.
Provide this type too for compatibility with std::vector<>.

Closes #15192.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73947 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-05-08 11:21:32 +00:00
Paul Cornett
8c1c11d689 declare wxQsort in vector.h as well as utils.h to work around circular header dependency mess
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-29 07:53:21 +00:00
Paul Cornett
da63066b65 silence GCC warning "enumeral and non-enumeral type in conditional expression"
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73005 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-24 21:49:04 +00:00
Vadim Zeitlin
84523830d5 Don't include wx/utils.h from wx/vector.h.
This will allow to include wx/vector.h from wx/list.h which is itself included
from wx/utils.h by breaking this circular dependency.

Don't use wxMin(), defined in wx/utils.h, in order to do this.

See #14814.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73002 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-24 17:36:19 +00:00
Vadim Zeitlin
2ff86a86a7 Add wxVector::assign().
Closes #14703.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-24 14:01:44 +00:00
Vadim Zeitlin
449cc35153 Don't make wxQsort() extern "C" nor use any special convention for it.
It doesn't make sense to require passing C functions to wxQsort() that we
define in a C++ library. We also don't need any special calling convention
here.

Notice that the only existing uses of wxQsort() inside wxWidgets itself were
not actually extern "C" and one of them didn't even use the correct calling
convention.

Also avoid using non-wx-prefixed CMPFUNCDATA identifier in a public header,
rename it to wxSortCallback instead.

Finally make wxQsort() documentation slightly more useful.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69566 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-10-27 21:10:48 +00:00
Vadim Zeitlin
01871bf642 Add wxUSE_STD_CONTAINERS and turn it on by default.
Previously, wxUSE_STL enabled both implicit conversion of wxString to
std::[w]string and use of standard containers for the implementation of their
wx equivalents. Split up the two roles now by allowing to enable the use of
the standard containers independently of (backwards incompatible) implicit
conversion in wxString and actually enable wxUSE_STD_CONTAINERS by default.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-03-30 14:16:04 +00:00
Vadim Zeitlin
258593354e Fix build with Borland C++ compiler.
Disable some parts of the code that this compiler had problems with. Add
parentheses to work around its bugs elsewhere.

Closes #12558.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66054 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-07 13:16:20 +00:00
Vadim Zeitlin
d8eff331e2 Use template class instead of template function in wxVectorSort().
This allows the code to compile with VC6 which has trouble with explicit
specification of the template functions instantiation.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-11 17:38:01 +00:00
Robin Dunn
0a492dbe7a #include <algorithm>
to fix problem in PCH-less STL builds

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63909 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-07 22:23:45 +00:00
Robin Dunn
068c8da4a8 (blind) fix for buildbot breakage with MSVC 6
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63907 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-07 21:56:08 +00:00
Robin Dunn
38723be1d5 Add wxVectorSort function for sorting wxVector<T> containers. Closes #11889
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63904 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-07 20:32:25 +00:00
Vadim Zeitlin
dbe0872fc8 Added wxVector::swap().
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-12 17:00:29 +00:00
Vadim Zeitlin
f6363458bc avoid g++ 4.3 warnings about conflict between parameter and method names (closes #10843)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60772 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-05-28 09:49:20 +00:00
Vadim Zeitlin
fa8224a15a reverted apparently accidental change of r57896
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57974 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-10 14:55:56 +00:00
Jouk Jansen
2e8fd8cc40 insert missing iclude file
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57896 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-07 19:50:26 +00:00
Vadim Zeitlin
e068310a5a added wxVector::resize()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57248 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-12-11 13:45:04 +00:00
Vadim Zeitlin
8d00e34735 fix typo in new wxVector(size_t, T) ctor
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57036 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-30 03:49:02 +00:00
Vadim Zeitlin
664e5ff93e add wxVector(size_t size[, const value_type& value]) ctors
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57031 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-29 22:28:44 +00:00
Paul Cornett
a09307abba check for self assignment in operator=
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56794 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-16 18:03:08 +00:00
Vadim Zeitlin
0e82d27088 use explicit global scope for a couple of more occurrences of new
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56733 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-10 23:55:01 +00:00
Vadim Zeitlin
54742e3426 use global operator new to fix compilation errors if type T overloads new (as wxObject does with wxUSE_MEMORY_TRACING)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56714 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-09 12:34:21 +00:00
Vadim Zeitlin
deb0c40261 remove extraneous returns
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56434 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-10-19 10:16:47 +00:00
Vadim Zeitlin
fc31181d2c use wxScopeGuard instead of an explicit try/catch(...)/throw: this suppresses wxUSE_EXCEPTIONS tests and also avoids MSVC unreachable code warnings
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-10-09 11:27:59 +00:00
Robert Roebling
946954d3bf Added reverse iterator to wxVector<T>
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55654 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-16 12:43:11 +00:00
Vadim Zeitlin
a470957ada fix fatal bug in wxVector copy ctor
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54964 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-08-03 23:58:24 +00:00
Vadim Zeitlin
0c73d13351 no changes, just fix a typo in comment
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-31 17:21:41 +00:00
Václav Slavík
c9faa9e9a2 Fixed compilation of wxVector<T> with VC6:
* reverted VC6 hack in wxIf<>, using helper struct instead of typedef
  didn't fix compilation, only caused the compiler to crash instead
  of emitting semi-useful errors
* changed wxVector to use typedef for Ops class instead of privately
  deriving from wxIf<...>::value; this is enough to make VC6 happy



git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-31 11:26:52 +00:00
Václav Slavík
6712283cf1 fixed wxVector<T> to work with non-POD types again; added optimization to keep using (much faster) realloc with types that are movable
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51330 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-22 11:29:21 +00:00
Václav Slavík
7df6b37a50 reverted last commit, it was wrong
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51303 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-21 08:45:19 +00:00
Václav Slavík
17c4163028 utils.h is not needed by wxVector, removed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51302 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-21 08:42:56 +00:00
Julian Smart
82b6efd2c2 Fix for VC++ 6 error
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-10 12:10:03 +00:00
Václav Slavík
c157b27e66 Use realloc() and placement new to manage vector's memory instead of
copying objects in T[] array. This is both more efficient and
matches std::vector<> semantics (erase() destroys the object immediately,
T doesn't have to be default-constructible).



git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-02 22:58:29 +00:00
Vadim Zeitlin
32aa5bda92 made deprecated erase() overload inline
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-12-20 00:53:24 +00:00
Vadim Zeitlin
f5851311d3 fix several mingw32 warnings (patch from Tim Stahlhut)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-10-02 11:36:35 +00:00
Chris Elliott
1cffe60012 fix for VC6 sorry
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48726 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-09-16 17:51:52 +00:00
Chris Elliott
9c9b12747f fix for VC6
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48725 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-09-16 17:47:03 +00:00
Václav Slavík
f9bf06acda VC6 compilation fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48350 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-08-23 12:40:32 +00:00
Julian Smart
2d615fe933 Compile fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48308 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-08-21 17:19:33 +00:00
Václav Slavík
0516de2cdb 1. fixed wxVector<T> iterators to actually point to what they're supposed to point to instead of crashing on any use
2. don't allocate memory for every element on the heap, store elements directly in the array instead of storing pointers to them

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48298 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-08-21 15:47:47 +00:00
Václav Slavík
9cf3337215 re-added wxVector<T>::erase(size_t) for backward compatibility
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48274 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-08-21 10:59:42 +00:00
Vadim Zeitlin
f631cd8e12 compilation fix for insert()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47741 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-07-27 00:17:27 +00:00
Robert Roebling
df4aed1cf0 Add iterators to wxVector, use std::vector in STL mode, correct wxVector::erase()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47712 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-07-25 10:19:08 +00:00
Václav Slavík
e966f815d4 changed wxVectorBase and WX_DECLARE_BASE into wxVector<T> template
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47212 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-07-07 10:09:42 +00:00
Václav Slavík
47b378bd88 removed extra semicolons (patch #1700459; fixes compilation with gcc's -pedantic flag)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45450 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-14 09:58:37 +00:00
Vadim Zeitlin
6f02a879ed make access specifiers for the virtual functions match their access in the base class (patch 1400131)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-02-08 21:47:09 +00:00
Chris Elliott
fa776a5809 apply SF patch 1252602 to remove warnings in bcc and watcom
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35109 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-08-05 15:23:38 +00:00
Vadim Zeitlin
1f32f58565 removed superfluous semicolons
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33244 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-04-02 00:34:04 +00:00
Julian Smart
655719367a Use old licence name
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2004-05-23 20:53:33 +00:00