[libcxx-commits] [PATCH] D98983: [libcxx] adds concepts `std::totally_ordered` and `std::totally_ordered_with`

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 29 19:46:42 PDT 2021

zoecarver added inline comments.

Comment at: libcxx/include/type_traits:4500
+#if _LIBCPP_STD_VER > 11
+template<class _Tp>
cjdb wrote:
> zoecarver wrote:
> > Why is this guarded on C++11?
> We did something similar in the `common_reference` patch where @ldionne and I agreed that it could be guarded on C++11 (I don't recall why). If you //really// want it in C++11 mode, I'll need to know what the C++03 guard is.
No, I'm saying we might as well remove the guard altogether. Just to make it easier to read/remove code bloat. All the compilers we support allow templated type aliases in C++03. WDYT?

Comment at: libcxx/test/std/concepts/comparison/concepts.totallyordered/totally_ordered.pass.cpp:115
+struct A {};
+// FIXME(cjdb): uncomment when operator<=> is implemented for each of these types.
+// static_assert(!std::totally_ordered<std::array<A, 10> >);
cjdb wrote:
> zoecarver wrote:
> > Then do we need to include all those extra headers (i.e., `std::vector`)?
> Yes, see immediately above.
Aha, I see.

Comment at: libcxx/test/std/concepts/comparison/concepts.totallyordered/totally_ordered_with.pass.cpp:1011
+    check_totally_ordered_with<std::array<int, 10>, std::array<int, 10> >());
+static_assert(!check_totally_ordered_with<std::array<int, 10>,
cjdb wrote:
> zoecarver wrote:
> > Nit: I don't think we want/need the space between these. This isn't run in C++03 mode. 
> https://github.com/llvm/llvm-project/blob/main/libcxx/.clang-format#L5
I guess we need that... hmm. It's too bad that we have to have (bad) C++03 styles for all of our code. Anyway, that's a bigger discussion/problem. 

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list