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
This only rejects in_place_t not cvin_place_t as required by [optional.optional.general] p3.
For the second constraint, why decay_t instead of remove_cv_t?
Do you really want these constraints in the first place? Using static_assert to enforce these rules is likely to support better diagnostics. Also, constraining the primary template with a requires-clause means that these constraints will be checked for the optional<T&> specialization when that is added. That won't be wrong because T& will never match in_place_t or nullopt_t but it's just unnecessary compile-time overhead to check constraints that will never match.
Finally, why is this requires-clause using redundant parentheses, like it's a function call? That style seems to be used inconsistently throughout the file. Edit: sorry, was looking at the wrong file when I wrote that! The parens in requires-clauses in the Beman/Optional26 code are fine.
The text was updated successfully, but these errors were encountered:
The lack of cv is probably me glossing over that in
T shall be a type other than cv in_place_t or cv nullopt_t that meets the Cpp17Destructible requirements (Table 35).
Should be able to move these to a static_assert in the definition of the template, also improving diagnostics instead of removing them from the overload set / making them not exist.
https://github.com/beman-project/Optional26/blob/bfeb9080c0d9c501965ae857a1decf7ed74686f5/include/Beman/Optional26/optional.hpp#L297-L299
This only rejects
in_place_t
not cvin_place_t
as required by [optional.optional.general] p3.For the second constraint, why
decay_t
instead ofremove_cv_t
?Do you really want these constraints in the first place? Using
static_assert
to enforce these rules is likely to support better diagnostics. Also, constraining the primary template with a requires-clause means that these constraints will be checked for theoptional<T&>
specialization when that is added. That won't be wrong becauseT&
will never matchin_place_t
ornullopt_t
but it's just unnecessary compile-time overhead to check constraints that will never match.Finally, why is this requires-clause using redundant parentheses, like it's a function call? That style seems to be used inconsistently throughout the file.Edit: sorry, was looking at the wrong file when I wrote that! The parens in requires-clauses in the Beman/Optional26 code are fine.The text was updated successfully, but these errors were encountered: