diff options
author | John Stiles <johnstiles@gmail.com> | 2017-03-15 09:48:41 +0300 |
---|---|---|
committer | John Stiles <johnstiles@gmail.com> | 2017-03-15 09:48:41 +0300 |
commit | d5d18cf6941518a33901a0ce522d38787269b8bb (patch) | |
tree | 0fa2297f2d359dbd6b662a86cb1187b1edf55b4c /include/rapidjson/prettywriter.h | |
parent | f0c108b5c9dc4b41a8ea39c8d418ff9a988edc86 (diff) |
Fix template length optimization issue in PrettyWriter
Missed PrettyWriter in the initial fix for Issue #889
Diffstat (limited to 'include/rapidjson/prettywriter.h')
-rw-r--r-- | include/rapidjson/prettywriter.h | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/include/rapidjson/prettywriter.h b/include/rapidjson/prettywriter.h index a9d0f02a..b68b687d 100644 --- a/include/rapidjson/prettywriter.h +++ b/include/rapidjson/prettywriter.h @@ -107,8 +107,7 @@ public: return Base::WriteString(str, length); } - template <typename T> - RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) String(const T* str, SizeType length, bool copy = false) { + bool String(const Ch* str, SizeType length, bool copy = false) { RAPIDJSON_ASSERT(str != 0); (void)copy; PrettyPrefix(kStringType); @@ -127,8 +126,7 @@ public: return Base::WriteStartObject(); } - template <typename T> - RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) Key(const T* str, SizeType length, bool copy = false) { return String(str, length, copy); } + bool Key(const Ch* str, SizeType length, bool copy = false) { return String(str, length, copy); } #if RAPIDJSON_HAS_STDSTRING bool Key(const std::basic_string<Ch>& str) { @@ -186,22 +184,8 @@ public: //@{ //! Simpler but slower overload. - template <typename T> - RAPIDJSON_ENABLEIF_RETURN((internal::IsSame<Ch, T>), (bool)) String(const T* const& str) { return String(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); - } + bool String(const Ch* str) { return String(str, internal::StrLen(str)); } + bool Key(const Ch* str) { return Key(str, internal::StrLen(str)); } //@} |