GenericStringRef: add NOEXCEPT, add ASSERT

* constructor from array is RAPIDJSON_NOEXCEPT
 * constructor from plain pointer missed an assert
This commit is contained in:
Philipp A. Hartmann 2014-08-31 22:01:57 +02:00
parent 56625bd9f0
commit 8ae2266c3b

View File

@ -279,7 +279,7 @@ struct GenericStringRef {
GenericValue instead.
*/
template<SizeType N>
GenericStringRef(const CharType (&str)[N])
GenericStringRef(const CharType (&str)[N]) RAPIDJSON_NOEXCEPT
: s(str), length(N-1) {}
//! Explicitly create string reference from \c const character pointer
@ -302,7 +302,7 @@ struct GenericStringRef {
GenericValue instead.
*/
explicit GenericStringRef(const CharType* str)
: s(str), length(internal::StrLen(str)){}
: s(str), length(internal::StrLen(str)){ RAPIDJSON_ASSERT(s != NULL); }
//! Create constant string reference from pointer and length
/*! \param str constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue