Add a new wxUSE_STD_CONTAINERS_COMPATIBLY option.
This option, which is on by default unless the use of STL is disabled, provides better interoperability with the standard library when it can be done without breaking backwards compatibility. The first example of its use is to allow passing std::vector<> of any string compatible type to wxItemContainer::Append(), Insert() and Set(), allowing to directly initialize various wxControls deriving from it such as wxChoice, wxComboBox, wxListBox from a std::vector<> of strings. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78066 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -253,6 +253,21 @@ public:
|
||||
*/
|
||||
int Append(const wxArrayString& items);
|
||||
|
||||
/**
|
||||
Appends several items at once into the control.
|
||||
|
||||
This is the same as the overload taking wxArrayString, except that it
|
||||
works with the standard vector container.
|
||||
|
||||
The template argument @c T can be any type convertible to wxString,
|
||||
including wxString itself but also @c std::string, @c char* or @c
|
||||
wchar_t*.
|
||||
|
||||
@since 3.1.0
|
||||
*/
|
||||
template <typename T>
|
||||
int Append(const std::vector<T>& items);
|
||||
|
||||
/**
|
||||
Appends several items at once into the control.
|
||||
|
||||
@@ -520,6 +535,21 @@ public:
|
||||
*/
|
||||
int Insert(const wxArrayString& items, unsigned int pos);
|
||||
|
||||
/**
|
||||
Inserts several items at once into the control.
|
||||
|
||||
This is the same as the overload taking wxArrayString, except that it
|
||||
works with the standard vector container.
|
||||
|
||||
The template argument @c T can be any type convertible to wxString,
|
||||
including wxString itself but also @c std::string, @c char* or @c
|
||||
wchar_t*.
|
||||
|
||||
@since 3.1.0
|
||||
*/
|
||||
template <typename T>
|
||||
int Insert(const std::vector<T>& items);
|
||||
|
||||
/**
|
||||
Inserts several items at once into the control.
|
||||
|
||||
@@ -633,6 +663,21 @@ public:
|
||||
*/
|
||||
void Set(const wxArrayString& items);
|
||||
|
||||
/**
|
||||
Replaces the current control contents with the given items.
|
||||
|
||||
This is the same as the overload taking wxArrayString, except that it
|
||||
works with the standard vector container.
|
||||
|
||||
The template argument @c T can be any type convertible to wxString,
|
||||
including wxString itself but also @c std::string, @c char* or @c
|
||||
wchar_t*.
|
||||
|
||||
@since 3.1.0
|
||||
*/
|
||||
template <typename T>
|
||||
void Set(const std::vector<T>& items);
|
||||
|
||||
/**
|
||||
Replaces the current control contents with the given items.
|
||||
|
||||
|
Reference in New Issue
Block a user