[libcxx-commits] [PATCH] D103734: [libcxx] moves <utility> content out of <type_traits> and into their own headers
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 8 14:33:10 PDT 2021
Quuxplusone added a comment.
@ldionne wrote:
> Recording offline discussion with Chris about how to move this forward:
>
> Use `static_cast<T&&>` instead of `std::forward` in `<type_traits>` (this should only impact the implementation of `__invoke`)
Yes please.
> Forward declare `std::swap` in `<type_traits>` just to implement the `is_XXX_swappable_with` traits
This likely won't work; but also, the historical libc++ approach here is to define **all** of the `swap`, `iter_swap`, `swap_ranges` algorithms directly in `<type_traits>` — they operate as a cohesive unit, so it makes sense to keep them together; and they are fundamental to a lot of libc++, so it makes sense to keep them in the "root-of-the-graph" header `<type_traits>` rather than trying to lift them up into some less fundamental header like `<utility>`. I strongly recommend keeping these three fundamental `swap`-related algorithms together. If you want to pull them out into something like `__utility/swap.h` or `__type_traits/swap.h`, that seems fine; but I would not recommend attempting to split `swap` apart from `swap_ranges` or even `iter_swap`.
> great examples of libc++'s failure to sanely split things with monolithic headers
I would say, great examples of //WG21's// failure to understand cyclic dependencies. libc++ is doing the best it can. :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103734/new/
https://reviews.llvm.org/D103734
More information about the libcxx-commits
mailing list