[libc++][compare] Implement three_way_comparable[_with] concepts
authorRuslan Arutyunyan <ruslan.arutyunyan@intel.com>
Sun, 5 Sep 2021 03:16:18 +0000 (20:16 -0700)
committerKent Ross <k@mad.cash>
Sun, 5 Sep 2021 19:38:08 +0000 (12:38 -0700)
commit8ce2675b1363ea0afa160e5fc564199857e8506c
tree170381a0b9ac53f180c9c3771ab4fc5c4aa99186
parent1a88bd68c17623c3ac8c9b75baa181bac271b494
[libc++][compare] Implement three_way_comparable[_with] concepts

Implementation of `three_way_comparable` and `three_way_comparable_with` concepts from <compare> header.

Please note that I have temporarily removed `<compare>` header from `<utility>` due to cyclic dependency that prevents using `<concepts>` header in `<compare>` one.

I tried to quickly resolve those issues including applying suggestions from @cjdb and dive deeper by myself but the problem seems more complicated that we thought initially.

I am in progress to prepare the patch with resolving this cyclic dependency between headers but for now I decided to put all that I have to the review to unblock people that depend on that functionality. At first glance the patch with resolving cyclic dependency is not so small (unless I find the way to make it smaller and cleaner) so I don't want to mix everything to one review.

Reviewed By: ldionne, cjdb, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D103478
libcxx/include/CMakeLists.txt
libcxx/include/__compare/three_way_comparable.h [new file with mode: 0644]
libcxx/include/compare
libcxx/include/module.modulemap
libcxx/test/libcxx/diagnostics/detail.headers/compare/three_way_comparable.module.verify.cpp [new file with mode: 0644]
libcxx/test/std/language.support/cmp/cmp.concept/three_way_comparable.compile.pass.cpp [new file with mode: 0644]
libcxx/test/std/language.support/cmp/cmp.concept/three_way_comparable_with.compile.pass.cpp [new file with mode: 0644]