mirror of
https://github.com/nlohmann/json.git
synced 2026-07-11 04:55:10 +00:00
c37d96115d
When a custom BinaryType is configured (other than the default std::vector<uint8_t>), users can now: 1. Assign values of that type directly to create binary values (not arrays) 2. Extract binary values back to that type with get<>() 3. Extract arrays to that type (for backward compatibility) Implementation: - Add is_compatible_binary_type trait to centralize SFINAE condition - Update to_json to accept custom BinaryType values directly - Update from_json to handle both binary and array inputs for custom BinaryType - Add #include <vector> with IWYU comment to from_json.hpp - Add comprehensive tests for assignment and array extraction - Update binary_t documentation with example This is purely additive and invisible to the default nlohmann::json alias, which continues to treat std::vector<uint8_t> as arrays. Signed-off-by: Niels Lohmann <mail@nlohmann.me>