diff --git a/src/json.hpp b/src/json.hpp index 52a86fcd6c..3c338eb8da 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -13182,6 +13182,15 @@ class basic_json return binary_reader(i).parse_cbor(strict); } + /*! + @copydoc from_cbor(detail::input_adapter, const bool) + */ + template::value, int> = 0> + static basic_json from_cbor(A1&& a1, A2&& a2, const bool strict = true) + { + return binary_reader(detail::input_adapter(std::forward(a1), std::forward(a2))).parse_cbor(strict); + } /*! @brief create a JSON value from an input in MessagePack format @@ -13260,6 +13269,16 @@ class basic_json return binary_reader(i).parse_msgpack(strict); } + /*! + @copydoc from_msgpack(detail::input_adapter, const bool) + */ + template::value, int> = 0> + static basic_json from_msgpack(A1&& a1, A2&& a2, const bool strict = true) + { + return binary_reader(detail::input_adapter(std::forward(a1), std::forward(a2))).parse_msgpack(strict); + } + /// @} ////////////////////////// diff --git a/test/src/unit-cbor.cpp b/test/src/unit-cbor.cpp index dda217a8e1..b808a8839a 100644 --- a/test/src/unit-cbor.cpp +++ b/test/src/unit-cbor.cpp @@ -1322,7 +1322,7 @@ TEST_CASE("single CBOR roundtrip") // check with different start index packed.insert(packed.begin(), 5, 0xff); - CHECK(j1 == json::from_cbor({packed.begin() + 5, packed.end()})); + CHECK(j1 == json::from_cbor(packed.begin() + 5, packed.end())); } } diff --git a/test/src/unit-msgpack.cpp b/test/src/unit-msgpack.cpp index 5efec54d99..f0f59fa416 100644 --- a/test/src/unit-msgpack.cpp +++ b/test/src/unit-msgpack.cpp @@ -1164,7 +1164,7 @@ TEST_CASE("single MessagePack roundtrip") // check with different start index packed.insert(packed.begin(), 5, 0xff); - CHECK(j1 == json::from_msgpack({packed.begin() + 5, packed.end()})); + CHECK(j1 == json::from_msgpack(packed.begin() + 5, packed.end())); } }