Skip to content

Commit 10ece22

Browse files
committed
raise priority of optional and variant above sequence
1 parent bab5f37 commit 10ece22

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ include::doc/pages/definitions.adoc[]
88
== Boost 1.89.0
99

1010
.API Changes
11+
* {issue}1050[#1050] Optionals that are ranges are categorised as optionals.
1112
* {issue}1086[#1086] Described class support is enabled for types with bases.
1213

1314
== Boost 1.87.0

doc/pages/conversion/overview.adoc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,20 @@ a| The result is a number equal to input and has the type
7070
|The result is a <<ref_string>>.
7171
|The result is constructed from a <<ref_string_view>>.
7272

73+
|Type satisfying <<ref_is_variant_like>>.
74+
|`std::variant` and similar types, e.g. `boost::variant2::variant`.
75+
|The result is equal to the result of conversion of the active variant
76+
alternative.
77+
|The result holds the first alternative for which a conversion succeeds.
78+
79+
|Type satisfying <<ref_is_optional_like>>
80+
|
81+
|If the input value is empty, the result is a `null`. Otherwise it is
82+
equivalent to conversion of the object stored inside of optional.
83+
|The result is default constructed if the input value is `null`. Otherwise the
84+
result is constructed from the result of conversion of the input to the
85+
type stored in optional.
86+
7387
|Type satisfying <<ref_is_map_like>>.
7488
|A one-to-one mapping (e.g. `std::map`) with string-like keys.
7589
|The result is an <<ref_object>>.
@@ -99,20 +113,6 @@ a| The result is a number equal to input and has the type
99113
|The result is the described enumerator, corresponding to the input
100114
<<ref_string>>.
101115

102-
|Type satisfying <<ref_is_variant_like>>.
103-
|`std::variant` and similar types, e.g. `boost::variant2::variant`.
104-
|The result is equal to the result of conversion of the active variant
105-
alternative.
106-
|The result holds the first alternative for which a conversion succeeds.
107-
108-
|Type satisfying <<ref_is_optional_like>>
109-
|
110-
|If the input value is empty, the result is a `null`. Otherwise it is
111-
equivalent to conversion of the object stored inside of optional.
112-
|The result is default constructed if the input value is `null`. Otherwise the
113-
result is constructed from the result of conversion of the input to the
114-
type stored in optional.
115-
116116
|Type satisfying <<ref_is_path_like>>.
117117
|`std::filesystem::path` and similar types, e.g. `boost::filesystem::path`.
118118
|The result is equal to the result of `path::generic_string`.

include/boost/json/impl/conversion.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,13 @@ using generic_conversion_category = mp11::mp_cond<
363363
std::is_floating_point<T>, floating_point_conversion_tag,
364364
is_null_like<T>, null_like_conversion_tag,
365365
is_string_like<T>, string_like_conversion_tag,
366+
is_variant_like<T>, variant_conversion_tag,
367+
is_optional_like<T>, optional_conversion_tag,
366368
is_map_like<T>, map_like_conversion_tag,
367369
is_sequence_like<T>, sequence_conversion_tag,
368370
is_tuple_like<T>, tuple_conversion_tag,
369371
is_described_class<T>, described_class_conversion_tag,
370372
is_described_enum<T>, described_enum_conversion_tag,
371-
is_variant_like<T>, variant_conversion_tag,
372-
is_optional_like<T>, optional_conversion_tag,
373373
is_path_like<T>, path_conversion_tag,
374374
// failed to find a suitable implementation
375375
mp11::mp_true, no_conversion_tag>;

0 commit comments

Comments
 (0)