File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 14
14
#include < string>
15
15
#include < vector>
16
16
17
+ namespace nlohmann ::detail {
18
+ template <> struct char_traits <std::byte> : char_traits<std::underlying_type_t <std::byte>> {
19
+ using char_type = std::byte;
20
+
21
+ // Redefine to_int_type function
22
+ static int_type to_int_type (char_type c) noexcept { return static_cast <int_type>(c); }
23
+ };
24
+ } // namespace nlohmann::detail
17
25
namespace power_grid_model_cpp {
18
-
19
26
namespace {
20
-
21
27
using namespace std ::string_literals;
22
28
23
29
constexpr char const * json_data =
@@ -83,9 +89,7 @@ TEST_CASE("API Serialization and Deserialization") {
83
89
SUBCASE (" Round trip" ) {
84
90
std::vector<std::byte> msgpack_data{};
85
91
msgpack_serializer.get_to_binary_buffer (0 , msgpack_data);
86
- std::span<std::underlying_type_t <std::byte>> const msgpack_data_view{
87
- reinterpret_cast <std::underlying_type_t <std::byte>*>(msgpack_data.data ()), msgpack_data.size ()};
88
- auto const json_document = nlohmann::ordered_json::from_msgpack (msgpack_data_view);
92
+ auto const json_document = nlohmann::ordered_json::from_msgpack (msgpack_data);
89
93
auto const json_result = json_document.dump (-1 );
90
94
CHECK (json_result == json_data);
91
95
}
You can’t perform that action at this time.
0 commit comments