This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3 PATCH] Implement P0307R2, Making Optional Greater Equal Again.


Tested on Linux-X64.

The test adjustments are so that the tests are kept valid, which
required adding a bunch of now-required relops to the test types. The new
transparent-but-non-synthesizing aspects of the relops are tested
separately. The constraints are a valid implementation of the
current Requires-clauses on these operators; I will file an LWG
issue suggesting that such Requires-clauses are instead made
SFINAE-constraints like in this implementation. The rationale
for that being that if such "wrapper types" are supposed to be
"transparent", it would be rather good if they are transparent
for SFINAE-querying for the existence of such relops as well, rather
than always report true and then fail to instantiate.

2016-07-11  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Implement P0307R2, Making Optional Greater Equal Again.
    * include/std/optional (__optional_relop_t): New.
    (operator==(const optional<_Tp>&, const optional<_Tp>&)): Constrain.
    (operator!=(const optional<_Tp>&, const optional<_Tp>&)):
    Constrain and make transparent.
    (operator<(const optional<_Tp>&, const optional<_Tp>&)): Constrain.
    (operator>(const optional<_Tp>&, const optional<_Tp>&)):
    Constrain and make transparent.
    (operator<=(const optional<_Tp>&, const optional<_Tp>&)): Likewise.
    (operator>=(const optional<_Tp>&, const optional<_Tp>&)): Likewise.
    (operator==(const optional<_Tp>&, const _Tp&): Constrain.
    (operator==(const _Tp&, const optional<_Tp>&)): Likewise.
    (operator!=(const optional<_Tp>&, _Tp const&)):
    Constrain and make transparent.
    (operator!=(const _Tp&, const optional<_Tp>&)): Likewise.
    (operator<(const optional<_Tp>&, const _Tp&)): Constrain.
    (operator<(const _Tp&, const optional<_Tp>&)): Likewise.
    (operator>(const optional<_Tp>&, const _Tp&)):
    Constrain and make transparent.
    (operator>(const _Tp&, const optional<_Tp>&)): Likewise.
    (operator<=(const optional<_Tp>&, const _Tp&)): Likewise.
    (operator<=(const _Tp&, const optional<_Tp>&)): Likewise.
    (operator>=(const optional<_Tp>&, const _Tp&)): Likewise.
    (operator>=(const _Tp&, const optional<_Tp>&)): Likewise.
    * testsuite/20_util/optional/constexpr/relops/2.cc: Adjust.
    * testsuite/20_util/optional/constexpr/relops/4.cc: Likewise.
    * testsuite/20_util/optional/relops/1.cc: Likewise.
    * testsuite/20_util/optional/relops/2.cc: Likewise.
    * testsuite/20_util/optional/relops/3.cc: Likewise.
    * testsuite/20_util/optional/relops/4.cc: Likewise.
    * testsuite/20_util/optional/requirements.cc: Add tests to verify
    that optional's relops are transparent and don't synthesize
    operators.

Attachment: P0307R2.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]