[PATCH] D55045: Add a version of std::function that includes a few optimizations.

Eric Fiselier via Phabricator reviews at reviews.llvm.org
Fri Nov 30 17:41:41 PST 2018


EricWF added a comment.

In D55045#1314652 <https://reviews.llvm.org/D55045#1314652>, @jsoyke wrote:

> FWIW, I'm slightly in favor of using different headers. For example, I just realized that this change currently leaves a bunch of baggage symbols laying around that the new code won't use, it would be easier to see that kind of thing if the internals of each function were just in it's own file.


I'm strongly against it. The harder it is to see all the implementations of a given function `f`, the harder it is to know they exist and keep them in sync. In my experience spreading these things out leads to real bugs.

@ldionne wrote:

> This is why I would like for us to plan on a solution that is more easily maintainable in the face of N implementations, not just 2 implementations (disregarding the C++03 implementations).


I would like that too. but that's not a blocking issue on this review.
I also don't agree that we'll see more `std::function` implementations in the future. We won't. We're not going to standardize additional features to `std::function` unless they're not ABI breaking. That is, if the standard does `function` it'll won't require another version of it.
Maybe you were thinking about things like `std::unique_function`?

Note that having the C++03 functions be in a separate file with no relation or interleaving with the C++11 implementation has caused plenty of bugs in the past where they diverge.


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D55045





More information about the libcxx-commits mailing list