You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/ref/json_type_traits.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,25 @@ which inherits from [false_type](http://www.cplusplus.com/reference/type_traits/
42
42
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
43
43
inform the `jsoncons` library that the type is already specialized.
44
44
45
+
### Specializations
46
+
47
+
`T`|`j.is<T>()`|`j.as<T>()`|j is assignable from `T`
48
+
--------|-----------|--------------|---
49
+
`Json`|`true`|self|<em>✓</em>
50
+
`Json::object`|`true` if `j.is_object()`, otherwise `false`|Compile-time error|<em>✓</em>
51
+
`Json::array`|`true` if `j.is_array()`, otherwise `false`|Compile-time error|<em>✓</em>
52
+
`bool`|`true` if `j.is_bool()`, otherwise `false`|as `bool`|<em>✓</em>
53
+
`null_type`|`true` if `j.is_null()`, otherwise `false`|`null_type()` value if j.is_null(), otherwise throws|<em>✓</em>
54
+
`const char_type*`|`true` if string, otherwise `false`|as `const char_type*`|<em>✓</em>
55
+
`char_type*`|`true` if `j.is_string()`, otherwise `false`|Compile-time error|<em>✓</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>✓</em>
57
+
`floating point types`|`true` if j.is_double() and value is in range, otherwise `false`|j numeric value cast to `T`|<em>✓</em>
58
+
`string`|`true` if j.is_string(), otherwise `false`|as string|<em>✓</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>✓</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>✓</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>✓</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>✓</em>
63
+
45
64
### Convenience Macros
46
65
47
66
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
194
213
195
214
These macro declarations must be placed at global scope, outside any namespace blocks, and `class_name` must be a fully namespace qualified name.
196
215
197
-
### Specializations
198
-
199
-
`T`|`j.is<T>()`|`j.as<T>()`|j is assignable from `T`
200
-
--------|-----------|--------------|---
201
-
`Json`|`true`|self|<em>✓</em>
202
-
`Json::object`|`true` if `j.is_object()`, otherwise `false`|Compile-time error|<em>✓</em>
203
-
`Json::array`|`true` if `j.is_array()`, otherwise `false`|Compile-time error|<em>✓</em>
204
-
`bool`|`true` if `j.is_bool()`, otherwise `false`|as `bool`|<em>✓</em>
205
-
`null_type`|`true` if `j.is_null()`, otherwise `false`|`null_type()` value if j.is_null(), otherwise throws|<em>✓</em>
206
-
`const char_type*`|`true` if string, otherwise `false`|as `const char_type*`|<em>✓</em>
207
-
`char_type*`|`true` if `j.is_string()`, otherwise `false`|Compile-time error|<em>✓</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>✓</em>
209
-
`floating point types`|`true` if j.is_double() and value is in range, otherwise `false`|j numeric value cast to `T`|<em>✓</em>
210
-
`string`|`true` if j.is_string(), otherwise `false`|as string|<em>✓</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>✓</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>✓</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>✓</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>✓</em>
215
-
216
216
### Examples
217
217
218
218
[Convert from and to standard library sequence containers](#A1)
0 commit comments