X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d3960469fcec7b68548cf89011e9dcf05dd14c85..ec38d07d0343b3fc5af03becd17ce798b96e05db:/include/wx/arrstr.h diff --git a/include/wx/arrstr.h b/include/wx/arrstr.h index f54844459b..14c291b249 100644 --- a/include/wx/arrstr.h +++ b/include/wx/arrstr.h @@ -91,6 +91,18 @@ public: #else // if !wxUSE_STL +// this shouldn't be defined for compilers not supporting template methods or +// without std::distance() -- and if all of the currently supported compilers +// do have it, then it can just be removed and wxHAS_VECTOR_TEMPLATE_ASSIGN +// code always used +#define wxHAS_VECTOR_TEMPLATE_ASSIGN + +#ifdef wxHAS_VECTOR_TEMPLATE_ASSIGN + #include "wx/beforestd.h" + #include + #include "wx/afterstd.h" +#endif // wxHAS_VECTOR_TEMPLATE_ASSIGN + class WXDLLIMPEXP_BASE wxArrayString { public: @@ -265,7 +277,26 @@ public: wxArrayString(const_iterator first, const_iterator last) { Init(false); assign(first, last); } wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); } - void assign(const_iterator first, const_iterator last); + +#ifdef wxHAS_VECTOR_TEMPLATE_ASSIGN + template + void assign(Iterator first, Iterator last) + { + clear(); + reserve(std::distance(first, last)); + for(; first != last; ++first) + push_back(*first); + } +#else // !wxHAS_VECTOR_TEMPLATE_ASSIGN + void assign(const_iterator first, const_iterator last) + { + clear(); + reserve(last - first); + for(; first != last; ++first) + push_back(*first); + } +#endif // wxHAS_VECTOR_TEMPLATE_ASSIGN/!wxHAS_VECTOR_TEMPLATE_ASSIGN + void assign(size_type n, const_reference v) { clear(); Add(v, n); } reference back() { return *(end() - 1); } @@ -461,7 +492,7 @@ private: const wxArrayString * array; } m_data; - DECLARE_NO_ASSIGN_CLASS(wxArrayStringsAdapter) + wxDECLARE_NO_ASSIGN_CLASS(wxArrayStringsAdapter); }; #endif // _WX_ARRSTR_H