json/tree: add std::string/string equality ops

This commit is contained in:
Danny Robson 2015-03-18 16:01:29 +11:00
parent 1d0240ba10
commit f73b39f063
2 changed files with 8 additions and 0 deletions

View File

@ -668,6 +668,11 @@ json::tree::string::operator== (const char *rhs) const
{ return rhs == m_value; } { return rhs == m_value; }
//-----------------------------------------------------------------------------
bool
json::tree::string::operator== (const std::string &rhs) const
{ return rhs == m_value; }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Number // Number

View File

@ -211,9 +211,12 @@ namespace json { namespace tree {
virtual bool operator==(const char *rhs) const; virtual bool operator==(const char *rhs) const;
virtual bool operator==(const string &rhs) const; virtual bool operator==(const string &rhs) const;
virtual bool operator==(const std::string &rhs) const;
virtual bool operator==(const node &rhs) const virtual bool operator==(const node &rhs) const
{ return rhs == *this; } { return rhs == *this; }
virtual bool operator!= (const std::string &rhs) const { return !(*this == rhs); }
virtual size_t size (void) const { return m_value.size (); } virtual size_t size (void) const { return m_value.size (); }
operator const std::string&(void) const { return m_value; } operator const std::string&(void) const { return m_value; }