🚑 made exceptions nothrow-copy-constructible #531

To have nothrow-copy-constructible exceptions, we inherit from
std::runtime_error which can cope with arbitrary-length error messages.
Intermediate strings are built with static functions and then passed to
the actual constructor.
上级 a58ed3cd
......@@ -894,7 +894,7 @@ $ make json_unit -Ctest
$ ./test/json_unit "*"
===============================================================================
All tests passed (11202597 assertions in 47 test cases)
All tests passed (11203022 assertions in 48 test cases)
```
Alternatively, you can use [CMake](https://cmake.org) and run
......
此差异已折叠。
此差异已折叠。
......@@ -57,3 +57,11 @@ static_assert(noexcept(json(pod{})), "");
static_assert(noexcept(j.get<pod>()), "");
static_assert(not noexcept(j.get<pod_bis>()), "");
static_assert(noexcept(json(pod{})), "");
// for ERR60-CPP (https://github.com/nlohmann/json/issues/531)
static_assert(std::is_nothrow_copy_constructible<json::exception>::value, "json::exception must be nothrow copy constructible");
static_assert(std::is_nothrow_copy_constructible<json::parse_error>::value, "json::parse_error must be nothrow copy constructible");
static_assert(std::is_nothrow_copy_constructible<json::invalid_iterator>::value, "json::invalid_iterator must be nothrow copy constructible");
static_assert(std::is_nothrow_copy_constructible<json::type_error>::value, "json::type_error must be nothrow copy constructible");
static_assert(std::is_nothrow_copy_constructible<json::out_of_range>::value, "json::out_of_range must be nothrow copy constructible");
static_assert(std::is_nothrow_copy_constructible<json::other_error>::value, "json::other_error must be nothrow copy constructible");
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册