openjdk-23: use OpenJDK 23 as the boot JDK
[oi-userland.git] / components / library / wxwidgets-3 / patches / 02-ambiguous-overload-string.patch
blobd691a35460460dba01454df451e1e20f819dca3c
1 --- wxWidgets-3.1.5/include/wx/string.h.orig 2022-02-24 20:36:30.420389723 +0000
2 +++ wxWidgets-3.1.5/include/wx/string.h 2022-02-24 20:36:37.956572846 +0000
3 @@ -32,6 +32,7 @@
4 #include <stdarg.h>
5 #include <limits.h>
6 #include <stdlib.h>
7 +#include <type_traits>
9 #include "wx/wxcrtbase.h" // for wxChar, wxStrlen() etc.
10 #include "wx/strvararg.h"
11 @@ -207,12 +208,14 @@
12 const wxStringCharType *AsInternal() const;
14 // allow expressions like "c_str()[0]":
15 - inline wxUniChar operator[](size_t n) const;
16 - wxUniChar operator[](int n) const { return operator[](size_t(n)); }
17 - wxUniChar operator[](long n) const { return operator[](size_t(n)); }
18 -#ifndef wxSIZE_T_IS_UINT
19 - wxUniChar operator[](unsigned int n) const { return operator[](size_t(n)); }
20 -#endif // size_t != unsigned int
21 + template<typename T, typename = std::enable_if<std::is_integral<T>::value>>
22 + inline wxUniChar operator[](T n) const
23 + {
24 + // NB: we intentionally use operator[] and not at() here because the former
25 + // works for the terminating NUL while the latter does not
26 + return (*m_str)[m_offset + n];
27 + }
30 // These operators are needed to emulate the pointer semantics of c_str():
31 // expressions like "wxChar *p = str.c_str() + 1;" should continue to work
32 @@ -1510,29 +1513,13 @@
33 Note that we we must define all of the overloads below to avoid
34 ambiguity when using str[0].
36 - wxUniChar operator[](int n) const
37 - { return at(n); }
38 - wxUniChar operator[](long n) const
39 + template<typename T, typename = std::enable_if<std::is_integral<T>::value>>
40 + inline wxUniChar operator[](T n) const
41 { return at(n); }
42 - wxUniChar operator[](size_t n) const
43 - { return at(n); }
44 -#ifndef wxSIZE_T_IS_UINT
45 - wxUniChar operator[](unsigned int n) const
46 - { return at(n); }
47 -#endif // size_t != unsigned int
49 - // operator versions of GetWriteableChar()
50 - wxUniCharRef operator[](int n)
51 - { return at(n); }
52 - wxUniCharRef operator[](long n)
53 + template<typename T, typename = std::enable_if<std::is_integral<T>::value>>
54 + inline wxUniCharRef operator[](T n)
55 { return at(n); }
56 - wxUniCharRef operator[](size_t n)
57 - { return at(n); }
58 -#ifndef wxSIZE_T_IS_UINT
59 - wxUniCharRef operator[](unsigned int n)
60 - { return at(n); }
61 -#endif // size_t != unsigned int
65 Overview of wxString conversions, implicit and explicit:
66 @@ -4366,13 +4353,6 @@
67 return (*m_str)[m_offset];
70 -inline wxUniChar wxCStrData::operator[](size_t n) const
72 - // NB: we intentionally use operator[] and not at() here because the former
73 - // works for the terminating NUL while the latter does not
74 - return (*m_str)[m_offset + n];
77 // ----------------------------------------------------------------------------
78 // more wxCStrData operators
79 // ----------------------------------------------------------------------------