[libcxx-commits] [PATCH] D119445: [libc++] Use std::ranges::swap_ranges in swap CPO

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 14 13:04:20 PST 2022


jloser added a comment.

In D119445#3320632 <https://reviews.llvm.org/D119445#3320632>, @ldionne wrote:

> This LGTM, however I would like to see this again after rebasing on top of D118736 <https://reviews.llvm.org/D118736>. D118736 <https://reviews.llvm.org/D118736> is a must-have, and I think both are going to be in conflict, so we might have to postpone doing this. Or we could do something like:
>
>   #if defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
>     // use for loop
>   #else
>     // use ranges::swap_ranges
>   #endif
>
> Once we stop using `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`, we can refactor this into only the `#else` branch.

The `#ifdef` dance you proposed seems reasonable, and then can clean it up once we stop using `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`. I haven't had a chance yet to look into fixing the header cycle issue this exposes when including `#include <__algorithm/ranges_swap_ranges.h>` from `<__concepts/swappable.h>`. I'll rebase and fix the cycle sometime this week.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119445/new/

https://reviews.llvm.org/D119445



More information about the libcxx-commits mailing list