Align the template parameter tables and record what is now diagnosed
Every table in the page is reformatted so each column is exactly as wide as its widest cell, which is what the review asked for in a dozen places: the separator rows that ran two dashes long, the stray spaces, and the columns padded well past their content. The row listing six containers that require a complete mapped type is split in two so that one cell no longer sets the width of the whole table. Content changes: NumberUnsignedType is described as any unsigned integer type at least as wide as NumberIntegerType rather than any unsigned integer type; the two requirements that are now static_asserts move out of the list of violations that are not caught at compile time; and the two places that require a non-const operator[] say why data() will not do (std::string has no non-const data() before C++17). Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 file changed
+31
-30
@@ -20,32 +20,29 @@ Requirements are split into two groups:
|
|||||||
|
|
||||||
!!! warning "Requirements are not checked"
|
!!! warning "Requirements are not checked"
|
||||||
|
|
||||||
Apart from a `#!cpp static_assert` on the array iterator category, the requirements below are not diagnosed with
|
Three requirements are checked with a `#!cpp static_assert`: the array iterator category, the width of
|
||||||
dedicated error messages. Violating most of them results in a compiler error somewhere inside the library. Six
|
[`BinaryType`](#binarytype)'s `value_type`, and [`NumberUnsignedType`](#numberintegertype-and-numberunsignedtype)
|
||||||
violations are not caught at compile time at all:
|
being at least as wide as [`NumberIntegerType`](#numberintegertype-and-numberunsignedtype). The rest are not
|
||||||
|
diagnosed with dedicated error messages, and violating most of them results in a compiler error somewhere inside
|
||||||
|
the library. Four violations are not caught at compile time at all:
|
||||||
|
|
||||||
- A [`StringType`](#stringtype) whose `data()` is not null-terminated compiles and silently misparses numbers,
|
- A [`StringType`](#stringtype) whose `data()` is not null-terminated compiles and silently misparses numbers,
|
||||||
because the lexer hands the buffer to `#!cpp std::strtoull`/`#!cpp std::strtoll`/`#!cpp std::strtod`.
|
because the lexer hands the buffer to `#!cpp std::strtoull`/`#!cpp std::strtoll`/`#!cpp std::strtod`.
|
||||||
- A [`BinaryType`](#binarytype) whose `value_type` is wider than one byte compiles and silently produces wrong
|
|
||||||
results, because the readers and writers reinterpret its storage as raw bytes.
|
|
||||||
- A stateful [`AllocatorType`](#allocatortype) compiles and silently ignores its state: allocation, deallocation,
|
- A stateful [`AllocatorType`](#allocatortype) compiles and silently ignores its state: allocation, deallocation,
|
||||||
and [`get_allocator()`](../../api/basic_json/get_allocator.md) each use a different default-constructed instance.
|
and [`get_allocator()`](../../api/basic_json/get_allocator.md) each use a different default-constructed instance.
|
||||||
- A [`NumberUnsignedType`](#numberintegertype-and-numberunsignedtype) too narrow to hold the absolute value of
|
|
||||||
every `NumberIntegerType` value silently corrupts: with `#!cpp std::int64_t`/`#!cpp std::uint32_t`,
|
|
||||||
`#!cpp basic_json(INT64_MIN).dump()` yields `#!json -0`.
|
|
||||||
- The two [cross-specialization conversions](#cross-specialization-conversions) below. These abort on an assertion
|
- The two [cross-specialization conversions](#cross-specialization-conversions) below. These abort on an assertion
|
||||||
in a normal build, and only fail silently under `#!cpp NDEBUG`.
|
in a normal build, and only fail silently under `#!cpp NDEBUG`.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
| Template parameter | Default | Notable substitutes |
|
| Template parameter | Default | Notable substitutes |
|
||||||
|-------------------------------------------------------------------|-----------------------------------|------------------------------------------------------------------------|
|
|-------------------------------------------------------------------|-----------------------------------|-----------------------------------------------------------------------|
|
||||||
| [`ObjectType`](#objecttype) | `std::map` | [`nlohmann::ordered_map`](../../api/ordered_map.md), Abseil hash maps |
|
| [`ObjectType`](#objecttype) | `std::map` | [`nlohmann::ordered_map`](../../api/ordered_map.md), Abseil hash maps |
|
||||||
| [`ArrayType`](#arraytype) | `std::vector` | `#!cpp std::deque` |
|
| [`ArrayType`](#arraytype) | `std::vector` | `#!cpp std::deque` |
|
||||||
| [`StringType`](#stringtype) | `std::string` | `std::string`-like types over `char` |
|
| [`StringType`](#stringtype) | `std::string` | `std::string`-like types over `char` |
|
||||||
| [`BooleanType`](#booleantype) | `bool` | none worth using |
|
| [`BooleanType`](#booleantype) | `bool` | none worth using |
|
||||||
| [`NumberIntegerType`](#numberintegertype-and-numberunsignedtype) | `std::int64_t` | any signed integer type |
|
| [`NumberIntegerType`](#numberintegertype-and-numberunsignedtype) | `std::int64_t` | any signed integer type |
|
||||||
| [`NumberUnsignedType`](#numberintegertype-and-numberunsignedtype) | `std::uint64_t` | any unsigned integer type |
|
| [`NumberUnsignedType`](#numberintegertype-and-numberunsignedtype) | `std::uint64_t` | any unsigned integer type at least as wide as `NumberIntegerType` |
|
||||||
| [`NumberFloatType`](#numberfloattype) | `double` | `float` (`long double`: no binary formats) |
|
| [`NumberFloatType`](#numberfloattype) | `double` | `float` (`long double`: no binary formats) |
|
||||||
| [`AllocatorType`](#allocatortype) | `std::allocator` | stateless allocators |
|
| [`AllocatorType`](#allocatortype) | `std::allocator` | stateless allocators |
|
||||||
| [`JSONSerializer`](#jsonserializer) | `adl_serializer` | serializers with the same interface |
|
| [`JSONSerializer`](#jsonserializer) | `adl_serializer` | serializers with the same interface |
|
||||||
@@ -208,7 +205,7 @@ The library does not sort or de-duplicate keys itself; the behavior described in
|
|||||||
### Compatible containers
|
### Compatible containers
|
||||||
|
|
||||||
| Container | Notes |
|
| Container | Notes |
|
||||||
|---------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
|
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
|
||||||
| `#!cpp std::map` (default) | |
|
| `#!cpp std::map` (default) | |
|
||||||
| [`nlohmann::ordered_map`](../../api/ordered_map.md) | used by [`ordered_json`](../../api/ordered_json.md); keeps insertion order |
|
| [`nlohmann::ordered_map`](../../api/ordered_map.md) | used by [`ordered_json`](../../api/ordered_json.md); keeps insertion order |
|
||||||
| [`nlohmann::fifo_map`](https://github.com/nlohmann/fifo_map) | keeps insertion order; adapter puts `fifo_map_compare` in the comparator slot |
|
| [`nlohmann::fifo_map`](https://github.com/nlohmann/fifo_map) | keeps insertion order; adapter puts `fifo_map_compare` in the comparator slot |
|
||||||
@@ -225,8 +222,9 @@ The library does not sort or de-duplicate keys itself; the behavior described in
|
|||||||
### Containers that cannot be used
|
### Containers that cannot be used
|
||||||
|
|
||||||
| Container | Reason |
|
| Container | Reason |
|
||||||
|---------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
|
|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
|
||||||
| `absl::btree_map`, `phmap::btree_map`, `gtl::btree_map`, `robin_hood::unordered_node_map`, `folly::F14FastMap`, `eastl::hash_map` | require a complete mapped type |
|
| `absl::btree_map`, `phmap::btree_map`, `gtl::btree_map` | require a complete mapped type |
|
||||||
|
| `robin_hood::unordered_node_map`, `folly::F14FastMap`, `eastl::hash_map` | require a complete mapped type |
|
||||||
| `eastl::map` | EASTL iterators do not work with `#!cpp std::iterator_traits` |
|
| `eastl::map` | EASTL iterators do not work with `#!cpp std::iterator_traits` |
|
||||||
| `tsl::ordered_map` | its iterators expose the mapped value as `#!cpp const` |
|
| `tsl::ordered_map` | its iterators expose the mapped value as `#!cpp const` |
|
||||||
| `QMap` | no `value_type` member type |
|
| `QMap` | no `value_type` member type |
|
||||||
@@ -279,7 +277,7 @@ using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
|
|||||||
### Compatible containers
|
### Compatible containers
|
||||||
|
|
||||||
| Container | Notes |
|
| Container | Notes |
|
||||||
|-------------------------------------------------------------------------------------------|----------------------------------------------------------|
|
|---------------------------------------------------------|-------------------------------------------------------------------------------------------|
|
||||||
| `#!cpp std::vector` (default) | |
|
| `#!cpp std::vector` (default) | |
|
||||||
| `#!cpp std::deque` | references survive appends, but not insertions elsewhere; see the `capacity()` note above |
|
| `#!cpp std::deque` | references survive appends, but not insertions elsewhere; see the `capacity()` note above |
|
||||||
| `#!cpp std::pmr::vector` | through an alias, as the allocator comes from `AllocatorType` instead |
|
| `#!cpp std::pmr::vector` | through an alias, as the allocator comes from `AllocatorType` instead |
|
||||||
@@ -292,7 +290,7 @@ using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
|
|||||||
### Containers that cannot be used
|
### Containers that cannot be used
|
||||||
|
|
||||||
| Container | Reason |
|
| Container | Reason |
|
||||||
|----------------------------------|----------------------------------------------------------------------------------------------|
|
|-------------------------------------|-----------------------------------------------------------------------------------------------|
|
||||||
| `#!cpp std::list` | no `operator[]`, and no random-access iterators |
|
| `#!cpp std::list` | no `operator[]`, and no random-access iterators |
|
||||||
| `eastl::vector`, `QList`, `QVector` | no `max_size()`; they handle the incomplete value type fine |
|
| `eastl::vector`, `QList`, `QVector` | no `max_size()`; they handle the incomplete value type fine |
|
||||||
| `absl::InlinedVector` | requires a complete value type, see the note above |
|
| `absl::InlinedVector` | requires a complete value type, see the note above |
|
||||||
@@ -328,7 +326,8 @@ using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
|
|||||||
### Required for the binary formats
|
### Required for the binary formats
|
||||||
|
|
||||||
- `resize(n)`, used by the readers to make room for a block of bytes.
|
- `resize(n)`, used by the readers to make room for a block of bytes.
|
||||||
- Non-const `operator[]`, into which the readers `#!cpp std::memcpy` those bytes.
|
- Non-const `operator[]`, into which the readers `#!cpp std::memcpy` those bytes. A non-`#!cpp const` `data()` would
|
||||||
|
serve just as well, but `#!cpp std::string` has only had one since C++17, and the library still supports C++11.
|
||||||
|
|
||||||
### Required for JSON Pointer, `flatten`, and `diff`
|
### Required for JSON Pointer, `flatten`, and `diff`
|
||||||
|
|
||||||
@@ -344,7 +343,7 @@ using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
|
|||||||
### Required for other functionality
|
### Required for other functionality
|
||||||
|
|
||||||
| Functionality | Additional requirement |
|
| Functionality | Additional requirement |
|
||||||
|--------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|
|-----------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| [`diff`](../../api/basic_json/diff.md), [`items`](../../api/basic_json/items.md), [`std::hash`](../../api/basic_json/std_hash.md) | conversion of a `#!cpp std::size_t` to `StringType`: either assignability from the result of `#!cpp std::to_string`, or an ADL overload `#!cpp void int_to_string(StringType&, std::size_t)` |
|
| [`diff`](../../api/basic_json/diff.md), [`items`](../../api/basic_json/items.md), [`std::hash`](../../api/basic_json/std_hash.md) | conversion of a `#!cpp std::size_t` to `StringType`: either assignability from the result of `#!cpp std::to_string`, or an ADL overload `#!cpp void int_to_string(StringType&, std::size_t)` |
|
||||||
| [`std::hash<basic_json>`](../../api/basic_json/std_hash.md) | additionally a specialization of `#!cpp std::hash<StringType>` |
|
| [`std::hash<basic_json>`](../../api/basic_json/std_hash.md) | additionally a specialization of `#!cpp std::hash<StringType>` |
|
||||||
| [`to_bson`](../../api/basic_json/to_bson.md) | `find(value_type)` and `npos` |
|
| [`to_bson`](../../api/basic_json/to_bson.md) | `find(value_type)` and `npos` |
|
||||||
@@ -355,7 +354,7 @@ using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
|
|||||||
### Compatible types
|
### Compatible types
|
||||||
|
|
||||||
| Type | Notes |
|
| Type | Notes |
|
||||||
|-------------------------------------------------------------------|---------------------------------------------------------------------------|
|
|-----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `#!cpp std::string` (default) | |
|
| `#!cpp std::string` (default) | |
|
||||||
| `#!cpp std::basic_string` with a custom **stateless** allocator | |
|
| `#!cpp std::basic_string` with a custom **stateless** allocator | |
|
||||||
| `#!cpp std::pmr::string` | see the warning below before relying on the memory resource |
|
| `#!cpp std::pmr::string` | see the warning below before relying on the memory resource |
|
||||||
@@ -367,7 +366,7 @@ using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
|
|||||||
### Types that cannot be used
|
### Types that cannot be used
|
||||||
|
|
||||||
| Type | Reason |
|
| Type | Reason |
|
||||||
|-----------------------------------------------------------------------|-----------------------------------------------------------------------|
|
|----------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
|
||||||
| `#!cpp std::wstring`, `#!cpp std::u16string`, `#!cpp std::u32string` | the character type is not one byte wide |
|
| `#!cpp std::wstring`, `#!cpp std::u16string`, `#!cpp std::u32string` | the character type is not one byte wide |
|
||||||
| `#!cpp std::u8string` | one byte wide, but `#!cpp char8_t` is not `#!cpp char`-compatible |
|
| `#!cpp std::u8string` | one byte wide, but `#!cpp char8_t` is not `#!cpp char`-compatible |
|
||||||
| `absl::Cord` | no `value_type`, and the storage is not contiguous |
|
| `absl::Cord` | no `value_type`, and the storage is not contiguous |
|
||||||
@@ -436,7 +435,8 @@ Both types are stored **directly** inside `basic_json`'s union.
|
|||||||
- Trivially default-constructible, trivially copyable, and trivially destructible (union member).
|
- Trivially default-constructible, trivially copyable, and trivially destructible (union member).
|
||||||
- `#!cpp std::numeric_limits` must be specialized for both types.
|
- `#!cpp std::numeric_limits` must be specialized for both types.
|
||||||
- `NumberUnsignedType` must be able to represent the absolute value of every `NumberIntegerType` value; serialization
|
- `NumberUnsignedType` must be able to represent the absolute value of every `NumberIntegerType` value; serialization
|
||||||
of negative numbers converts the value to `NumberUnsignedType`.
|
of negative numbers converts the value to `NumberUnsignedType`. A `#!cpp static_assert` requires it to be at least as
|
||||||
|
wide as `NumberIntegerType`, which is what that amounts to for the standard integer types.
|
||||||
- Both types must fit into the internal 64-character number buffer used by
|
- Both types must fit into the internal 64-character number buffer used by
|
||||||
[`dump`](../../api/basic_json/dump.md), which is the case for all standard integer types.
|
[`dump`](../../api/basic_json/dump.md), which is the case for all standard integer types.
|
||||||
- [`std::hash<basic_json>`](../../api/basic_json/std_hash.md) additionally requires `#!cpp std::hash` specializations.
|
- [`std::hash<basic_json>`](../../api/basic_json/std_hash.md) additionally requires `#!cpp std::hash` specializations.
|
||||||
@@ -451,7 +451,7 @@ therefore silently changes parse results rather than raising an error. See
|
|||||||
### Compatible types
|
### Compatible types
|
||||||
|
|
||||||
| Type pair | Support |
|
| Type pair | Support |
|
||||||
|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
|
|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `#!cpp std::int64_t` / `#!cpp std::uint64_t` (default) | full |
|
| `#!cpp std::int64_t` / `#!cpp std::uint64_t` (default) | full |
|
||||||
| `#!cpp std::int32_t` / `#!cpp std::uint32_t`, `#!cpp long long` / `#!cpp unsigned long long` | full; narrower types change which literals the parser can represent |
|
| `#!cpp std::int32_t` / `#!cpp std::uint32_t`, `#!cpp long long` / `#!cpp unsigned long long` | full; narrower types change which literals the parser can represent |
|
||||||
| any other pair of standard signed/unsigned integer types | full |
|
| any other pair of standard signed/unsigned integer types | full |
|
||||||
@@ -491,7 +491,7 @@ binary32 or binary64 field and have no encoding for `#!cpp long double`.
|
|||||||
### Compatible types
|
### Compatible types
|
||||||
|
|
||||||
| Type | Support |
|
| Type | Support |
|
||||||
|-----------------------------|-----------------------------------------------------------------------------------------------------|
|
|--------------------------|-----------------------------------------------------------------------------------------------------------------------|
|
||||||
| `#!cpp double` (default) | full; short round-trip output through Grisu2 |
|
| `#!cpp double` (default) | full; short round-trip output through Grisu2 |
|
||||||
| `#!cpp float` | full; short round-trip output through Grisu2 |
|
| `#!cpp float` | full; short round-trip output through Grisu2 |
|
||||||
| `#!cpp long double` | `dump` and `parse` only; the binary format writers do not compile, as they only handle IEEE 754 binary32 and binary64 |
|
| `#!cpp long double` | `dump` and `parse` only; the binary format writers do not compile, as they only handle IEEE 754 binary32 and binary64 |
|
||||||
@@ -523,7 +523,7 @@ binary32 or binary64 field and have no encoding for `#!cpp long double`.
|
|||||||
### Compatible types
|
### Compatible types
|
||||||
|
|
||||||
| Type | Support |
|
| Type | Support |
|
||||||
|-----------------------------------------------------------------|----------------------------------------------------|
|
|-------------------------------------------------------------------|----------------------------------------|
|
||||||
| `#!cpp std::allocator` (default) | full |
|
| `#!cpp std::allocator` (default) | full |
|
||||||
| a custom stateless allocator template | full |
|
| a custom stateless allocator template | full |
|
||||||
| stateful allocators, e.g. `#!cpp std::pmr::polymorphic_allocator` | not usable; see the requirements above |
|
| stateful allocators, e.g. `#!cpp std::pmr::polymorphic_allocator` | not usable; see the requirements above |
|
||||||
@@ -552,7 +552,7 @@ binary32 or binary64 field and have no encoding for `#!cpp long double`.
|
|||||||
### Compatible types
|
### Compatible types
|
||||||
|
|
||||||
| Type | Support |
|
| Type | Support |
|
||||||
|-------------------------------------------------------------------|-------------------------------------------------------------------------|
|
|---------------------------------------------------------------------------|-------------------------------------------------------------------|
|
||||||
| [`nlohmann::adl_serializer`](../../api/adl_serializer/index.md) (default) | full |
|
| [`nlohmann::adl_serializer`](../../api/adl_serializer/index.md) (default) | full |
|
||||||
| a class template deriving from `adl_serializer` | full; the usual way to change behavior while keeping the defaults |
|
| a class template deriving from `adl_serializer` | full; the usual way to change behavior while keeping the defaults |
|
||||||
| an unrelated template with the same interface | full, but it has to handle every type the library converts |
|
| an unrelated template with the same interface | full, but it has to handle every type the library converts |
|
||||||
@@ -571,10 +571,11 @@ using binary_t = nlohmann::byte_container_with_subtype<BinaryType>;
|
|||||||
- A non-`final` class type -- [`byte_container_with_subtype`](../../api/byte_container_with_subtype/index.md) derives
|
- A non-`final` class type -- [`byte_container_with_subtype`](../../api/byte_container_with_subtype/index.md) derives
|
||||||
from it publicly.
|
from it publicly.
|
||||||
- A member type `value_type` that is **exactly one byte** wide (e.g., `#!cpp std::uint8_t`, `#!cpp char`, or
|
- A member type `value_type` that is **exactly one byte** wide (e.g., `#!cpp std::uint8_t`, `#!cpp char`, or
|
||||||
`#!cpp std::byte`). Readers and writers reinterpret the container's storage as raw bytes. A wider `value_type` is
|
`#!cpp std::byte`). Readers and writers reinterpret the container's storage as raw bytes, so a wider `value_type` is
|
||||||
**not diagnosed**: it compiles and silently produces wrong results.
|
rejected with a `#!cpp static_assert`.
|
||||||
- Contiguous storage: the binary readers `#!cpp std::memcpy` into `#!cpp &binary[n]`, the writers `reinterpret_cast`
|
- Contiguous storage: the binary readers `#!cpp std::memcpy` into `#!cpp &binary[n]`, the writers `reinterpret_cast`
|
||||||
`data()`.
|
`data()`. `#!cpp data() + n` would do for the readers too, but they share one helper with
|
||||||
|
[`StringType`](#stringtype), whose non-`#!cpp const` `data()` is C++17 and later only.
|
||||||
- Default-constructible, copy-constructible, and move-constructible.
|
- Default-constructible, copy-constructible, and move-constructible.
|
||||||
- Member functions `size()`, `empty()`, `data()`, `resize()`, `operator[]`, `back()`, `begin()`, `end()`, `cbegin()`,
|
- Member functions `size()`, `empty()`, `data()`, `resize()`, `operator[]`, `back()`, `begin()`, `end()`, `cbegin()`,
|
||||||
and `cend()` with random-access iterators, and `insert(pos, first, last)`, which the CBOR reader uses to join the
|
and `cend()` with random-access iterators, and `insert(pos, first, last)`, which the CBOR reader uses to join the
|
||||||
@@ -595,7 +596,7 @@ such a container to a `basic_json` value.
|
|||||||
### Compatible containers
|
### Compatible containers
|
||||||
|
|
||||||
| Container | Notes |
|
| Container | Notes |
|
||||||
|------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|
|
|---------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|
|
||||||
| `#!cpp std::vector<std::uint8_t>` (default) | |
|
| `#!cpp std::vector<std::uint8_t>` (default) | |
|
||||||
| `#!cpp std::vector<char>`, `#!cpp std::vector<std::byte>` | `dump()` writes the bytes as 0..255 whichever is used |
|
| `#!cpp std::vector<char>`, `#!cpp std::vector<std::byte>` | `dump()` writes the bytes as 0..255 whichever is used |
|
||||||
| `boost::container::vector<std::uint8_t>`, `boost::container::small_vector<std::uint8_t, N>` | |
|
| `boost::container::vector<std::uint8_t>`, `boost::container::small_vector<std::uint8_t, N>` | |
|
||||||
@@ -606,7 +607,7 @@ such a container to a `basic_json` value.
|
|||||||
### Containers that cannot be used
|
### Containers that cannot be used
|
||||||
|
|
||||||
| Container | Reason |
|
| Container | Reason |
|
||||||
|--------------------------------------------------------|-----------------------------------------------------------------------------------------|
|
|------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `QByteArray` | no `empty()` (it spells that `isEmpty()`); its `insert` takes an index rather than an iterator; and it converts to `string_t`, which makes `to_json` ambiguous between a string and a binary value |
|
| `QByteArray` | no `empty()` (it spells that `isEmpty()`); its `insert` takes an index rather than an iterator; and it converts to `string_t`, which makes `to_json` ambiguous between a string and a binary value |
|
||||||
| `#!cpp std::string` | `binary_t::container_type` and `string_t` would be the same type, so the two [`swap`](../../api/basic_json/swap.md) overloads collide and `basic_json` cannot be instantiated at all |
|
| `#!cpp std::string` | `binary_t::container_type` and `string_t` would be the same type, so the two [`swap`](../../api/basic_json/swap.md) overloads collide and `basic_json` cannot be instantiated at all |
|
||||||
| `#!cpp std::deque<std::uint8_t>` | storage is not contiguous, so there is no `data()` |
|
| `#!cpp std::deque<std::uint8_t>` | storage is not contiguous, so there is no `data()` |
|
||||||
@@ -636,7 +637,7 @@ See [`json_base_class_t`](../../api/basic_json/json_base_class_t.md) for an exam
|
|||||||
### Compatible types
|
### Compatible types
|
||||||
|
|
||||||
| Type | Support |
|
| Type | Support |
|
||||||
|----------------------------------------------------------|--------------------------------------------------------------|
|
|----------------------------------------------|----------------------------------------------------------------------------|
|
||||||
| `#!cpp void` (default) | an empty base class is used; no effect on `basic_json` |
|
| `#!cpp void` (default) | an empty base class is used; no effect on `basic_json` |
|
||||||
| any default-constructible, non-`final` class | full; see [`json_base_class_t`](../../api/basic_json/json_base_class_t.md) |
|
| any default-constructible, non-`final` class | full; see [`json_base_class_t`](../../api/basic_json/json_base_class_t.md) |
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user