While this doesn't make, and never made, any sense (pointers should be
stored in a plain, non-object array), we still should continue to
support it for compatibility.
Fix the problem introduced by 97684a9267
by writing "T const&" instead of "const T&" as the latter didn't have
the same meaning when the macro parameter "T" expanded into "U*" as
"const" applied to "U", making this type incompatible with the actual
one.
Also extend the unit test to check for this.
Don't cast function pointers of incompatible types, this resulted in gcc
8 -Wcast-function-type warnings and could hide real errors.
To fix this, overload wxBaseArray::Sort() to accept either the "legacy"
sort function compatible with qsort() or a function compatible with
std::sort(), as it seems both variants could be used before. Also make
the type of the latter function customizable via a new optional Sorter
template parameter in wxBaseArray in order to allow wxSortedArrayString
to specify its own variant of it, taking (const) references instead of
values.
This complicates things, but should preserve compatibility while being
type-safe and, also, allows to simplify _WX_DEFINE_SORTED_TYPEARRAY_2 by
not passing the sort function signature to it any more.
Don't cast function pointers of incompatible types, this resulted in gcc
8 -Wcast-function-type warnings and could hide real errors.
Use normal, taking elements by value, sort function for in wxBaseArray
methods used by the sorted arrays only and provide Sort() overloads for
both this sort function variant and the compatible with qsort() one
taking pointers to the elements.
Put the code implementing object arrays, i.e. arrays owning pointers to
the objects, into wxBaseObjectArray<> instead of _WX_DECLARE_OBJARRAY
macro.
Also simplify WX_DEFINE_OBJARRAY() by leaving only the definitions of
functions creating and destroying the objects in it (they have to be
there and not in the template itself to allow using template with
incomplete classes).
Add wxBaseSortedArray<> template instead of putting all the code inside
_WX_DEFINE_SORTED_TYPEARRAY_2 macro.
There should be no changes, but the code is now easier to read and
modify.
Dramatically simplify dynamic array macros by keeping only the
implementation previously used in wxUSE_STD_CONTAINERS case and dropping
the other one, as we can use the std::vector-based implementation on top
of our own wxVector<>, which is available whether wxUSE_STD_CONTAINERS
is 0 or 1.
This allows to get rid of tons of ugly macro-based code without breaking
compatibility.
Exporting these classes doesn't seem necessary as they only have inline
functions and doing it results in problems with MSVC as it also, apparently,
exports the corresponding specialization of std::vector<T> from the wxWidgets
DLLs which can clash with the use of std::vector<T> in the user code or even
in 3rd party libraries included in wx itself, such as Scintilla, so this
change fixes link errors in "DLL Debug" build configuration when using MSVC.
Closes#10884.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.
If nothing else, this will make an eventual transition to Git simpler.
Closes#14487.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This method did nothing if its argument was less than the current array size,
as it was just a synonym for SetSize() which was documented to behave like
this, but this was inconsistent with std::vector and wxVector resize() which
does shrink the array, so change wxArray version to shrink it too.
Closes#15195.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73986 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This function incorrectly returned index from the end of the array when
searching from the end. Fixed to work as the non-STL version.
Fixes#13626.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Adding items to wxSortedArrayString should always keep them sorted but while
Add() did this, push_back() didn't breaking the class invariant.
Redefine push_back() in _WX_DEFINE_SORTED_TYPEARRAY_2 macro to fix this and
add a unit test checking that wxSortedArrayString::push_back() does work now.
Closes#13134.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67429 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
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