[libcxx-commits] [PATCH] D103734: [libcxx] moves <utility> content out of <type_traits> and into their own headers

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 8 13:20:21 PDT 2021


cjdb added a comment.

In D103734#2806363 <https://reviews.llvm.org/D103734#2806363>, @ldionne wrote:

>> <utility> needs to be broken down first, in order to achieve that.
>
> Why? Can't you split `<functional>` without tackling down `<utility>`?

Sadly, no. Assuming I've properly split `<functional>`, I get a circular dep between the two. IIRC it's specifically `std::pair` that's causing me grief right now, but that depends on a fair bit in `<utility>`, so I decided that would be a better starting point.

> Note: Generally speaking, I'm very happy to split up headers into smaller headers that make sense (I've been fighting hard for that since the beginning). But I'm struggling to see the structure in this patch. It just looks to me as though random bits are being split into headers, and also I'm not sure about the granularity. In particular, splitting up type traits this way (one trait per header, but not always) does not appear like an improvement to me.

I make no defence for how I've split `<type_traits>`. I'd prefer one trait per header, but I think you had other ideas and so I kind of went "we can properly fix this when someone has the time/courage to turn to `<type_traits>`".

> If you're trying to split up `<functional>`, is it possible to do it without touching other headers? If not, let's figure out a way forward.

See above. And below. It's certainly not possible to avoid touching `<utility>`, because that's where `unary_function` currently lives.

> Also, do you really have to touch anything in `<type_traits>` except stuff that would clearly belong elsewhere (like `iter_swap` and `swap_ranges`, which are great examples of libc++'s failure to sanely split things with monolithic headers)?

I've moved out the bare minimum of `<type_traits>` in this patch to facilitate the things I've put into self-contained headers. `std::move`, `std::forward`, and `std::swap` aren't supposed to be in `<type_traits>`, but the monolithic header model kinda forced us to do it this way.


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