File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -442,7 +442,7 @@ json::object_t json::get() const
442442 }
443443}
444444
445- json::operator const std::string () const
445+ json::operator std::string () const
446446{
447447 return get<std::string>();
448448}
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ class json
175175 T get () const ;
176176
177177 // / implicit conversion to string representation
178- operator const std::string () const ;
178+ operator std::string () const ;
179179 // / implicit conversion to integer (only for numbers)
180180 operator int () const ;
181181 // / implicit conversion to double (only for numbers)
Original file line number Diff line number Diff line change @@ -773,6 +773,7 @@ TEST_CASE("string")
773773 CHECK_NOTHROW (auto v = j.get <json::array_t >());
774774 CHECK_THROWS_AS (auto v = j.get <json::object_t >(), std::logic_error);
775775 CHECK_NOTHROW (auto v = j.get <std::string>());
776+ CHECK_NOTHROW (auto v = static_cast <std::string>(j));
776777 CHECK_THROWS_AS (auto v = j.get <bool >(), std::logic_error);
777778 CHECK_THROWS_AS (auto v = j.get <int >(), std::logic_error);
778779 CHECK_THROWS_AS (auto v = j.get <double >(), std::logic_error);
You can’t perform that action at this time.
0 commit comments