This has not been adopted by LEWG/LWG yet, but was submitted as a proposed resolution for a new LWG issue; optional can't current be compared to a T, and an optional can't be compared to something non-T that is comparable to a T. This approach fixes both of those problems, allowing optional's comparisons to actually work like the comparisons of the underlying type. Tested on Linux-x64. 2017-02-19 Ville Voutilainen Make optional's comparisons be two-parameter templates. * include/std/optional (operator==(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator==(const optional<_Tp>&, const optional<_Up>&). (operator!=(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator!=(const optional<_Tp>&, const optional<_Up>&). (operator<(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator<(const optional<_Tp>&, const optional<_Up>&. (operator>(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator>(const optional<_Tp>&, const optional<_Up>&. (operator<=(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator<=(const optional<_Tp>&, const optional<_Up>&). (operator>=(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator>=(const optional<_Tp>&, const optional<_Up>&). (operator==(const optional<_Tp>&, const _Tp&)): Turn into operator==(const optional<_Tp>&, const _Up&). (operator==(const _Tp&, const optional<_Tp>&)): Turn into operator==(const _Up&, const optional<_Tp>&). (operator!=(const optional<_Tp>&, const _Tp&)): Turn into operator!=(const optional<_Tp>&, const _Up&). (operator!=(const _Tp&, const optional<_Tp>&)): Turn into operator!=(const _Up&, const optional<_Tp>&). (operator<(const optional<_Tp>&, const _Tp&)): Turn into operator<(const optional<_Tp>&, const _Up&). (operator<(const _Tp&, const optional<_Tp>&)): Turn into operator<(const _Up&, const optional<_Tp>&). (operator>(const optional<_Tp>&, const _Tp&)): Turn into operator>(const optional<_Tp>&, const _Up&). (operator>(const _Tp&, const optional<_Tp>&)): Turn into operator>(const _Up&, const optional<_Tp>&). (operator<=(const optional<_Tp>&, const _Tp&)): Turn into operator<=(const optional<_Tp>&, const _Up&). (operator<=(const _Tp&, const optional<_Tp>&)): Turn into operator<=(const _Up&, const optional<_Tp>&). (operator>=(const optional<_Tp>&, const _Tp&)): Turn into operator>=(const optional<_Tp>&, const _Up&). (operator>=(const _Tp&, const optional<_Tp>&)): Turn into operator>=(const _Up&, const optional<_Tp>&). * testsuite/20_util/optional/relops/7.cc: New.