Don't over promise in wxItemContainer documentation

It only accepts std::vector<wxString>, not std::vector<T> for any type
convertible to wxString as both the documentation and the code misleadingly
claimed.
This commit is contained in:
Vadim Zeitlin
2017-01-14 00:23:12 +01:00
parent 1f56389e8b
commit da36cbff06
3 changed files with 8 additions and 27 deletions

View File

@@ -479,9 +479,8 @@ public:
} }
#if wxUSE_STD_CONTAINERS_COMPATIBLY #if wxUSE_STD_CONTAINERS_COMPATIBLY
// construct an adapter from a vector of strings (of any type) // construct an adapter from a vector of strings
template <class T> wxArrayStringsAdapter(const std::vector<wxString>& strings)
wxArrayStringsAdapter(const std::vector<T>& strings)
: m_type(wxSTRING_POINTER), m_size(strings.size()) : m_type(wxSTRING_POINTER), m_size(strings.size())
{ {
m_data.ptr = &strings[0]; m_data.ptr = &strings[0];

View File

@@ -221,8 +221,7 @@ public:
{ return AppendItems(wxArrayStringsAdapter(n, items), clientData); } { return AppendItems(wxArrayStringsAdapter(n, items), clientData); }
#if wxUSE_STD_CONTAINERS_COMPATIBLY #if wxUSE_STD_CONTAINERS_COMPATIBLY
template <class T> int Append(const std::vector<wxString>& items)
int Append(const std::vector<T>& items)
{ return AppendItems(items); } { return AppendItems(items); }
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY #endif // wxUSE_STD_CONTAINERS_COMPATIBLY
@@ -266,8 +265,7 @@ public:
{ return InsertItems(wxArrayStringsAdapter(n, items), pos, clientData); } { return InsertItems(wxArrayStringsAdapter(n, items), pos, clientData); }
#if wxUSE_STD_CONTAINERS_COMPATIBLY #if wxUSE_STD_CONTAINERS_COMPATIBLY
template <class T> int Insert(const std::vector<wxString>& items, unsigned int pos)
int Insert(const std::vector<T>& items, unsigned int pos)
{ return InsertItems(items, pos); } { return InsertItems(items, pos); }
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY #endif // wxUSE_STD_CONTAINERS_COMPATIBLY
@@ -288,8 +286,7 @@ public:
{ Clear(); Append(n, items, clientData); } { Clear(); Append(n, items, clientData); }
#if wxUSE_STD_CONTAINERS_COMPATIBLY #if wxUSE_STD_CONTAINERS_COMPATIBLY
template <class T> void Set(const std::vector<wxString>& items)
void Set(const std::vector<T>& items)
{ Clear(); Append(items); } { Clear(); Append(items); }
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY #endif // wxUSE_STD_CONTAINERS_COMPATIBLY

View File

@@ -259,14 +259,9 @@ public:
This is the same as the overload taking wxArrayString, except that it This is the same as the overload taking wxArrayString, except that it
works with the standard vector container. 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 @since 3.1.0
*/ */
template <typename T> int Append(const std::vector<wxString>& items);
int Append(const std::vector<T>& items);
/** /**
Appends several items at once into the control. Appends several items at once into the control.
@@ -541,14 +536,9 @@ public:
This is the same as the overload taking wxArrayString, except that it This is the same as the overload taking wxArrayString, except that it
works with the standard vector container. 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 @since 3.1.0
*/ */
template <typename T> int Insert(const std::vector<wxString>& items);
int Insert(const std::vector<T>& items);
/** /**
Inserts several items at once into the control. Inserts several items at once into the control.
@@ -669,14 +659,9 @@ public:
This is the same as the overload taking wxArrayString, except that it This is the same as the overload taking wxArrayString, except that it
works with the standard vector container. 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 @since 3.1.0
*/ */
template <typename T> void Set(const std::vector<wxString>& items);
void Set(const std::vector<T>& items);
/** /**
Replaces the current control contents with the given items. Replaces the current control contents with the given items.