Skip to content

Commit 4d4e539

Browse files
committed
Doc update
1 parent 2f725f9 commit 4d4e539

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

doc/ref/json_type_traits.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,25 @@ which inherits from [false_type](http://www.cplusplus.com/reference/type_traits/
4242
This traits class may be specialized for a user-defined type with a [true_type](http://www.cplusplus.com/reference/type_traits/true_type/) value to
4343
inform the `jsoncons` library that the type is already specialized.
4444
45+
### Specializations
46+
47+
`T`|`j.is<T>()`|`j.as<T>()`|j is assignable from `T`
48+
--------|-----------|--------------|---
49+
`Json`|`true`|self|<em>&#x2713;</em>
50+
`Json::object`|`true` if `j.is_object()`, otherwise `false`|Compile-time error|<em>&#x2713;</em>
51+
`Json::array`|`true` if `j.is_array()`, otherwise `false`|Compile-time error|<em>&#x2713;</em>
52+
`bool`|`true` if `j.is_bool()`, otherwise `false`|as `bool`|<em>&#x2713;</em>
53+
`null_type`|`true` if `j.is_null()`, otherwise `false`|`null_type()` value if j.is_null(), otherwise throws|<em>&#x2713;</em>
54+
`const char_type*`|`true` if string, otherwise `false`|as `const char_type*`|<em>&#x2713;</em>
55+
`char_type*`|`true` if `j.is_string()`, otherwise `false`|Compile-time error|<em>&#x2713;</em>
56+
`integral types`|`true` if `j.is_int64()` or `j.is_uint64()` and value is in range, otherwise `false`|j numeric value cast to `T`|<em>&#x2713;</em>
57+
`floating point types`|`true` if j.is_double() and value is in range, otherwise `false`|j numeric value cast to `T`|<em>&#x2713;</em>
58+
`string`|`true` if j.is_string(), otherwise `false`|as string|<em>&#x2713;</em>
59+
STL sequence container (other than string) e.g. std::vector|`true` if array and each value is assignable to a `Json` value, otherwise `false`|if array and each value is convertible to `value_type`, as container, otherwise throws|<em>&#x2713;</em>
60+
STL associative container e.g. std::map|`true` if object and each `mapped_type` is assignable to `Json`, otherwise `false`|if object and each member value is convertible to `mapped_type`, as container|<em>&#x2713;</em>
61+
`std::tuple`|`true` if `j.is_array()` and each array element is assignable to the corresponding `tuple` element, otherwise false|tuple with array elements converted to tuple elements|<em>&#x2713;</em>
62+
`std::pair`|`true` if `j.is_array()` and `j.size()==2` and each array element is assignable to the corresponding pair element, otherwise false|pair with array elements converted to pair elements|<em>&#x2713;</em>
63+
4564
### Convenience Macros
4665
4766
The `jsoncons` library provides a number of macros that can be used to generate the code to specialize `json_type_traits`
@@ -194,25 +213,6 @@ requires that all member names be present in the JSON. The class template must h
194213

195214
These macro declarations must be placed at global scope, outside any namespace blocks, and `class_name` must be a fully namespace qualified name.
196215

197-
### Specializations
198-
199-
`T`|`j.is<T>()`|`j.as<T>()`|j is assignable from `T`
200-
--------|-----------|--------------|---
201-
`Json`|`true`|self|<em>&#x2713;</em>
202-
`Json::object`|`true` if `j.is_object()`, otherwise `false`|Compile-time error|<em>&#x2713;</em>
203-
`Json::array`|`true` if `j.is_array()`, otherwise `false`|Compile-time error|<em>&#x2713;</em>
204-
`bool`|`true` if `j.is_bool()`, otherwise `false`|as `bool`|<em>&#x2713;</em>
205-
`null_type`|`true` if `j.is_null()`, otherwise `false`|`null_type()` value if j.is_null(), otherwise throws|<em>&#x2713;</em>
206-
`const char_type*`|`true` if string, otherwise `false`|as `const char_type*`|<em>&#x2713;</em>
207-
`char_type*`|`true` if `j.is_string()`, otherwise `false`|Compile-time error|<em>&#x2713;</em>
208-
`integral types`|`true` if `j.is_int64()` or `j.is_uint64()` and value is in range, otherwise `false`|j numeric value cast to `T`|<em>&#x2713;</em>
209-
`floating point types`|`true` if j.is_double() and value is in range, otherwise `false`|j numeric value cast to `T`|<em>&#x2713;</em>
210-
`string`|`true` if j.is_string(), otherwise `false`|as string|<em>&#x2713;</em>
211-
STL sequence container (other than string) e.g. std::vector|`true` if array and each value is assignable to a `Json` value, otherwise `false`|if array and each value is convertible to `value_type`, as container, otherwise throws|<em>&#x2713;</em>
212-
STL associative container e.g. std::map|`true` if object and each `mapped_type` is assignable to `Json`, otherwise `false`|if object and each member value is convertible to `mapped_type`, as container|<em>&#x2713;</em>
213-
`std::tuple`|`true` if `j.is_array()` and each array element is assignable to the corresponding `tuple` element, otherwise false|tuple with array elements converted to tuple elements|<em>&#x2713;</em>
214-
`std::pair`|`true` if `j.is_array()` and `j.size()==2` and each array element is assignable to the corresponding pair element, otherwise false|pair with array elements converted to pair elements|<em>&#x2713;</em>
215-
216216
### Examples
217217

218218
[Convert from and to standard library sequence containers](#A1)

0 commit comments

Comments
 (0)