Skip to content

Commit c4e3d62

Browse files
committed
Fix msvc x64 compilation issue
Disambiguate by putting the ENABLEIF on the return value instead of in the argument list.
1 parent cdea825 commit c4e3d62

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

include/rapidjson/prettywriter.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class PrettyWriter : public Writer<OutputStream, SourceEncoding, TargetEncoding,
108108
}
109109

110110
template <typename T>
111-
bool String(const T* str, SizeType length, bool copy = false, RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) {
111+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) String(const T* str, SizeType length, bool copy = false) {
112112
RAPIDJSON_ASSERT(str != 0);
113113
(void)copy;
114114
PrettyPrefix(kStringType);
@@ -128,7 +128,7 @@ class PrettyWriter : public Writer<OutputStream, SourceEncoding, TargetEncoding,
128128
}
129129

130130
template <typename T>
131-
bool Key(const T* str, SizeType length, bool copy = false, RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) { return String(str, length, copy); }
131+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) Key(const T* str, SizeType length, bool copy = false) { return String(str, length, copy); }
132132

133133
#if RAPIDJSON_HAS_STDSTRING
134134
bool Key(const std::basic_string<Ch>& str) {
@@ -187,18 +187,18 @@ class PrettyWriter : public Writer<OutputStream, SourceEncoding, TargetEncoding,
187187

188188
//! Simpler but slower overload.
189189
template <typename T>
190-
bool String(const T* const& str, RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) { return String(str, internal::StrLen(str)); }
190+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) String(const T* const& str) { return String(str, internal::StrLen(str)); }
191191
template <typename T>
192-
bool Key(const T* const& str, RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) { return Key(str, internal::StrLen(str)); }
192+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) Key(const T* const& str) { return Key(str, internal::StrLen(str)); }
193193

194194
//! The compiler can give us the length of quoted strings for free.
195195
template <typename T, size_t N>
196-
bool String(const T (&str)[N], RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) {
196+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) String(const T (&str)[N]) {
197197
RAPIDJSON_ASSERT(str[N-1] == '\0'); // you must pass in a null-terminated string (quoted constant strings are always null-terminated)
198198
return String(str, N-1);
199199
}
200200
template <typename T, size_t N>
201-
bool Key(const T (&str)[N], RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) {
201+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) Key(const T (&str)[N]) {
202202
RAPIDJSON_ASSERT(str[N-1] == '\0'); // you must pass in a null-terminated string (quoted constant strings are always null-terminated)
203203
return Key(str, N-1);
204204
}

include/rapidjson/writer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class Writer {
200200
}
201201

202202
template <typename T>
203-
bool String(const T* str, SizeType length, bool copy = false, RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) {
203+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) String(const T* str, SizeType length, bool copy = false) {
204204
RAPIDJSON_ASSERT(str != 0);
205205
(void)copy;
206206
Prefix(kStringType);
@@ -220,7 +220,7 @@ class Writer {
220220
}
221221

222222
template <typename T>
223-
bool Key(const T* str, SizeType length, bool copy = false, RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) { return String(str, length, copy); }
223+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) Key(const T* str, SizeType length, bool copy = false) { return String(str, length, copy); }
224224

225225
bool EndObject(SizeType memberCount = 0) {
226226
(void)memberCount;
@@ -251,18 +251,18 @@ class Writer {
251251

252252
//! Simpler but slower overload.
253253
template <typename T>
254-
bool String(const T* const& str, RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) { return String(str, internal::StrLen(str)); }
254+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) String(const T* const& str) { return String(str, internal::StrLen(str)); }
255255
template <typename T>
256-
bool Key(const T* const& str, RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) { return Key(str, internal::StrLen(str)); }
256+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) Key(const T* const& str) { return Key(str, internal::StrLen(str)); }
257257

258258
//! The compiler can give us the length of quoted strings for free.
259259
template <typename T, size_t N>
260-
bool String(const T (&str)[N], RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) {
260+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) String(const T (&str)[N]) {
261261
RAPIDJSON_ASSERT(str[N-1] == '\0'); // you must pass in a null-terminated string (quoted constant strings are always null-terminated)
262262
return String(str, N-1);
263263
}
264264
template <typename T, size_t N>
265-
bool Key(const T (&str)[N], RAPIDJSON_ENABLEIF((internal::IsSame<Ch, T>))) {
265+
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) Key(const T (&str)[N]) {
266266
RAPIDJSON_ASSERT(str[N-1] == '\0'); // you must pass in a null-terminated string (quoted constant strings are always null-terminated)
267267
return Key(str, N-1);
268268
}

0 commit comments

Comments
 (0)