Skip to content

Commit

Permalink
if define RAPIDJSON_HAS_STDSTRING, FindMember use std::string, but it
Browse files Browse the repository at this point in the history
also use internal::StrLen to get the string lengtht,
when it call FindMember(StringRef(name)).
Now use GenericValue construct it, then can use the std::string.size.
now it will be faster.
  • Loading branch information
fuzhufang committed Jul 14, 2016
1 parent 369de87 commit b67ff2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/rapidjson/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -1169,8 +1169,8 @@ class GenericValue {
\return Iterator to member, if it exists.
Otherwise returns \ref MemberEnd().
*/
MemberIterator FindMember(const std::basic_string<Ch>& name) { return FindMember(StringRef(name)); }
ConstMemberIterator FindMember(const std::basic_string<Ch>& name) const { return FindMember(StringRef(name)); }
MemberIterator FindMember(const std::basic_string<Ch>& name) { return FindMember(GenericValue(StringRef(name))); }
ConstMemberIterator FindMember(const std::basic_string<Ch>& name) const { return FindMember(GenericValue(StringRef(name))); }
#endif

//! Add a member (name-value pair) to the object.
Expand Down

0 comments on commit b67ff2f

Please sign in to comment.