@@ -471,7 +471,7 @@ namespace json
471471 // / Throws <see cref="json_exception"/> if the value is not a number
472472 // / </summary>
473473 // / <returns>An instance of number class</returns>
474- _ASYNCRTIMP json::number as_number () const ;
474+ _ASYNCRTIMP const json::number& as_number () const ;
475475
476476 // / <summary>
477477 // / Converts the JSON value to a C++ bool, if and only if it is a Boolean value.
@@ -509,7 +509,7 @@ namespace json
509509 // / Converts the JSON value to a C++ STL string, if and only if it is a string value.
510510 // / </summary>
511511 // / <returns>A C++ STL string representation of the value</returns>
512- _ASYNCRTIMP utility::string_t as_string () const ;
512+ _ASYNCRTIMP const utility::string_t & as_string () const ;
513513
514514 // / <summary>
515515 // / Compares two JSON values for equality.
@@ -644,15 +644,13 @@ namespace json
644644 private:
645645 std::string _message;
646646 public:
647- json_exception () {}
648647 json_exception (const utility::char_t * const &message) : _message(utility::conversions::to_utf8string(message)) { }
649648
650649 // Must be narrow string because it derives from std::exception
651650 const char * what () const CPPREST_NOEXCEPT
652651 {
653652 return _message.c_str ();
654653 }
655- ~json_exception () CPPREST_NOEXCEPT {}
656654 };
657655
658656 namespace details
@@ -1386,15 +1384,15 @@ namespace json
13861384 virtual bool is_integer () const { throw json_exception (_XPLATSTR (" not a number" )); }
13871385 virtual bool is_double () const { throw json_exception (_XPLATSTR (" not a number" )); }
13881386
1389- virtual json::number as_number () { throw json_exception (_XPLATSTR (" not a number" )); }
1387+ virtual const json::number& as_number () { throw json_exception (_XPLATSTR (" not a number" )); }
13901388 virtual double as_double () const { throw json_exception (_XPLATSTR (" not a number" )); }
13911389 virtual int as_integer () const { throw json_exception (_XPLATSTR (" not a number" )); }
13921390 virtual bool as_bool () const { throw json_exception (_XPLATSTR (" not a boolean" )); }
13931391 virtual json::array& as_array () { throw json_exception (_XPLATSTR (" not an array" )); }
13941392 virtual const json::array& as_array () const { throw json_exception (_XPLATSTR (" not an array" )); }
13951393 virtual json::object& as_object () { throw json_exception (_XPLATSTR (" not an object" )); }
13961394 virtual const json::object& as_object () const { throw json_exception (_XPLATSTR (" not an object" )); }
1397- virtual utility::string_t as_string () const { throw json_exception (_XPLATSTR (" not a string" )); }
1395+ virtual const utility::string_t & as_string () const { throw json_exception (_XPLATSTR (" not a string" )); }
13981396
13991397 virtual size_t size () const { return 0 ; }
14001398
@@ -1464,7 +1462,7 @@ namespace json
14641462 return m_number.to_int32 ();
14651463 }
14661464
1467- virtual number as_number () { return m_number; }
1465+ virtual const number& as_number () { return m_number; }
14681466
14691467 protected:
14701468 virtual void format (std::basic_string<char >& stream) const ;
@@ -1554,7 +1552,7 @@ namespace json
15541552
15551553 virtual json::value::value_type type () const { return json::value::String; }
15561554
1557- virtual utility::string_t as_string () const ;
1555+ virtual const utility::string_t & as_string () const ;
15581556
15591557 virtual void serialize_impl (std::string& str) const
15601558 {
0 commit comments