Commit 0e5b3ec Swagtoy
committed
1 parent db179d7 commit 0e5b3ec Copy full SHA for 0e5b3ec
File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 11
11
#include < cstdio>
12
12
#include < cstring>
13
13
#include < cwchar>
14
- #include < type_traits>
15
14
16
15
/* HACK: import these string methods from MT's util/string.h */
17
16
extern std::wstring utf8_to_wide (std::string_view input);
@@ -167,7 +166,7 @@ class string
167
166
168
167
// ! Assignment operator for strings, ASCII and Unicode
169
168
template <class B >
170
- string<T> &operator =(const B * c)
169
+ string<T> &operator =(const B *const c)
171
170
{
172
171
if (!c) {
173
172
clear ();
@@ -179,6 +178,8 @@ class string
179
178
(uintptr_t )c >= (uintptr_t )(str.data ()) &&
180
179
(uintptr_t )c < (uintptr_t )(str.data () + str.size ()));
181
180
}
181
+
182
+ if ((void *)c == (void *)c_str ()) return *this ;
182
183
183
184
u32 len = calclen (c);
184
185
// In case `c` is a pointer to our own buffer, we may not resize first
You can’t perform that action at this time.
0 commit comments