@@ -28,16 +28,17 @@ https://en.cppreference.com/w/cpp/language/types[fundamental types], such as
2828include::../../../test/snippets.cpp[tag=snippet_conv_1,indent=0]
2929----
3030
31- For the type `T` , the appropriate conversion approach is chosen from the
32- following list of categories. The first matching category is selected.
31+ For the type `T` , the appropriate conversion approach is chosen according to
32+ the trait <<ref_conversion_category_of>>. By default the trait attempts to pick
33+ the first matching category from the following list.
3334
3435.Conversion categories
3536[%autowidth,cols=4]
3637|===
3738|Category of T|Comment|`value_from` behavior|`value_to` behavior
3839
39- |Custom conversion.
40- |
40+ |Custom conversion
41+ |Uses `tag_invoke` overload.
4142|Custom behavior.
4243|Custom behavior.
4344
@@ -55,66 +56,66 @@ following list of categories. The first matching category is selected.
5556|
5657a| The result is a number equal to input and has the type
5758
58- * `std::int64_t` , if `T` is a signed integer' ; or
59+ * `std::int64_t` , if `T` is a signed integer; or
5960* `std::uint64_t` , if `T` is an unsigned integer; or
6061* `double` otherwise.
6162|The result is created via <<ref_value_to_number>>.
6263
63- |Type satisfying <<ref_is_null_like >>
64+ |<<ref_null_category >>
6465|Intended for types like {std_monostate} .
6566|The result is a null value.
6667|The result is default-constructed.
6768
68- |Type satisfying <<ref_is_string_like>>.
69- |A sequence of `char` s, e.g. `std::string` .
69+ |<<ref_string_category>>
70+ |A sequence of `` char`` s, e.g. {std_string} .
7071|The result is a <<ref_string>>.
7172|The result is constructed from a <<ref_string_view>>.
7273
73- |Type satisfying <<ref_is_variant_like>>.
74- |`std::variant` and similar types, e.g. `boost::variant2::variant` .
74+ |<<ref_variant_category>>
75+ |{std_variant} and similar types, e.g. {ref_variant} .
7576|The result is equal to the result of conversion of the active variant
7677 alternative.
7778|The result holds the first alternative for which a conversion succeeds.
7879
79- |Type satisfying <<ref_is_optional_like >>
80- |
80+ |<<ref_optional_category >>
81+ |{std_optional} and similar types, e.g. {ref_optional} .
8182|If the input value is empty, the result is a `null` . Otherwise it is
8283 equivalent to conversion of the object stored inside of optional.
8384|The result is default constructed if the input value is `null` . Otherwise the
8485 result is constructed from the result of conversion of the input to the
8586 type stored in optional.
8687
87- |Type satisfying <<ref_is_map_like>>.
88- |A one-to-one mapping (e.g. `std::map` ) with string-like keys.
88+ |<<ref_map_category>>
89+ |A one-to-one mapping (e.g. {std_map} ) with string-like keys.
8990|The result is an <<ref_object>>.
9091|The result is default-constructed, and elements are `insert` -ed at the end.
9192
92- |Type satisfying <<ref_is_sequence_like>>.
93- |A sequence of elements, e.g. `std::vector` .
93+ |<<ref_sequence_category>>
94+ |A sequence of elements, e.g. {std_vector} .
9495|The result is an <<ref_array>>.
9596|The result is default-constructed, and elements are `insert` -ed at the end.
9697
97- |Type satisfying <<ref_is_tuple_like>>.
98- |A heterogenous sequence with fixed size, e.g. `std::tuple` and `std::pair` .
98+ |<<ref_tuple_category>>
99+ |A heterogenous sequence with fixed size, e.g. {std_tuple} and {std_pair} .
99100|The result is an <<ref_array>>.
100101|The result is constructed with the array elements as constructor arguments.
101102
102- |Type satisfying <<ref_is_described_class >>
103+ |<<ref_described_class_category >>
103104|
104105|The result is an <<ref_object>> with described members' names as keys.
105106|The result is default-constructed and described members are assigned
106107 corresponding values.
107108
108- |Type satisfying <<ref_is_described_enum >>
109+ |<<ref_described_enum_category >>
109110|
110111|If the input value is equal to one of the described enumerators, the result is
111112 a <<ref_string>>, containing its name. Otherwise it's equal to the input
112113 value converted to its underlying type.
113114|The result is the described enumerator, corresponding to the input
114115 <<ref_string>>.
115116
116- |Type satisfying <<ref_is_path_like>>.
117- |`std::filesystem::path` and similar types, e.g. `boost::filesystem::path` .
117+ |<<ref_path_category>>
118+ |{std_path} and similar types, e.g. {ref_path} .
118119|The result is equal to the result of `path::generic_string` .
119120|The result is constructed from two pointers to `const char` .
120121|===
@@ -127,10 +128,10 @@ contained objects is applied recursively. For example:
127128include::../../../test/snippets.cpp[tag=snippet_conv_recursive,indent=0]
128129----
129130
130- Here, the map is converted into an <<ref_object>>, since it matches
131- <<ref_is_map_like >>. Each of its keys is converted into a <<ref_string>>, as
132- `std::string` matches <<ref_is_string_like >>, and each of its values is
133- converted into an <<ref_array>>, as `std::pair` matches <<ref_is_tuple_like >>.
131+ Here, the map is converted to an <<ref_object>>, since its conversion category
132+ is <<ref_map_category >>. Each of its keys is converted into a <<ref_string>>,
133+ as `std::string` is of <<ref_string_category >>, and each of its values is
134+ converted into an <<ref_array>>, as `std::pair` is of <<ref_tuple_category >>.
134135Finally, elements of pairs are converted into a `std::int64_t` number and
135136a `bool` .
136137
0 commit comments