Remove broken templatized string length optimization
It did not support char arrays.
This commit is contained in:
parent
84a0356608
commit
55f8a32020
@ -199,8 +199,7 @@ public:
|
|||||||
return EndValue(WriteString(str, length));
|
return EndValue(WriteString(str, length));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
bool String(const Ch* str, SizeType length, bool copy = false) {
|
||||||
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) String(const T* str, SizeType length, bool copy = false) {
|
|
||||||
RAPIDJSON_ASSERT(str != 0);
|
RAPIDJSON_ASSERT(str != 0);
|
||||||
(void)copy;
|
(void)copy;
|
||||||
Prefix(kStringType);
|
Prefix(kStringType);
|
||||||
@ -219,8 +218,7 @@ public:
|
|||||||
return WriteStartObject();
|
return WriteStartObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
bool Key(const Ch* str, SizeType length, bool copy = false) { return String(str, length, copy); }
|
||||||
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) Key(const T* str, SizeType length, bool copy = false) { return String(str, length, copy); }
|
|
||||||
|
|
||||||
bool EndObject(SizeType memberCount = 0) {
|
bool EndObject(SizeType memberCount = 0) {
|
||||||
(void)memberCount;
|
(void)memberCount;
|
||||||
@ -250,22 +248,8 @@ public:
|
|||||||
//@{
|
//@{
|
||||||
|
|
||||||
//! Simpler but slower overload.
|
//! Simpler but slower overload.
|
||||||
template <typename T>
|
bool String(const Ch* const& str) { return String(str, internal::StrLen(str)); }
|
||||||
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) String(const T* const& str) { return String(str, internal::StrLen(str)); }
|
bool Key(const Ch* const& str) { return Key(str, internal::StrLen(str)); }
|
||||||
template <typename T>
|
|
||||||
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) Key(const T* const& str) { return Key(str, internal::StrLen(str)); }
|
|
||||||
|
|
||||||
//! The compiler can give us the length of quoted strings for free.
|
|
||||||
template <typename T, size_t N>
|
|
||||||
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) String(const T (&str)[N]) {
|
|
||||||
RAPIDJSON_ASSERT(str[N-1] == '\0'); // you must pass in a null-terminated string (quoted constant strings are always null-terminated)
|
|
||||||
return String(str, N-1);
|
|
||||||
}
|
|
||||||
template <typename T, size_t N>
|
|
||||||
RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) Key(const T (&str)[N]) {
|
|
||||||
RAPIDJSON_ASSERT(str[N-1] == '\0'); // you must pass in a null-terminated string (quoted constant strings are always null-terminated)
|
|
||||||
return Key(str, N-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user