[libcxx-commits] [PATCH] D114912: [libc++] [P1614] Hidden-friend operator<=> for string_view.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 1 14:31:08 PST 2021


Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, libc++, jloser.
Quuxplusone added a project: libc++.
Herald added a subscriber: mgorny.
Quuxplusone requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: libcxx-commits, sstefan1.
Herald added 1 blocking reviewer(s): libc++.

This implements *almost* conforming behavior for string_view's `operator<=>`.
I'm making it a hidden friend so that we can get rid of the "additional sufficient overloads" that were needed to deal with implicit conversions when it was a free function template. The Microsoft ABI can't deal with having multiple templates that instantiate to the same signature like that. (Microsoft works around their ABI by adding defaulted template parameters to the "sufficient overloads" so that they mangle differently. We could also do that, but I'm agitating to keep this simple at the cost of corner-case conformance.)

N.B.: I know this is (ever so slightly) non-conforming; I'm claiming that libc++ should flex our vendor muscles and do it anyway, because the benefit is large and the cost is merely technical/pedantic.

The new test file is modeled on D114658 <https://reviews.llvm.org/D114658>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114912

Files:
  libcxx/include/CMakeLists.txt
  libcxx/include/__compare/comp_cat.h
  libcxx/include/__string
  libcxx/include/module.modulemap
  libcxx/include/string_view
  libcxx/test/libcxx/diagnostics/detail.headers/compare/comp_cat.module.verify.cpp
  libcxx/test/std/strings/string.view/string.view.comparison/spaceship.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114912.391127.patch
Type: text/x-patch
Size: 20227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211201/e887a386/attachment-0001.bin>


More information about the libcxx-commits mailing list