-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for reference_wrappers in make_xxx #176
Comments
After benchmarking the compile-time cost of adding support for this,
This is really lame; all we want is a
|
@ericniebler, I saw that you also forward declare stuff in namespace |
Perhaps there is a third (still far from ideal): What if we allow the client to pass a reference_wrapper-like template as a template template arg? This is not ideal for a number of reasons, and I'm not well-versed in the performance implications of this (might be really bad, idk), but at a glance it seems like this might strike a balance between performance and usability. It would certainly add some unfortunate complexity to the code. Sure, nobody really wants to pass std::reference_wrapper as a template arg, but nobody wants to use a hana::reference_wrapper shim or wait for a standardized forward declaration either. Is that a plausible solution? |
Edit: I just realized there is an open PR for this. I'll check it out later (I'm on mobile so I can't easily edit my above comment). |
@badair I think this is not necessarily a bad solution. However, this issue is stalled because of the problems documented in #179 (comment) more than those documented above. |
What are your thoughts on wrapping |
I think it is not necessary to take this burden upon ourselves. |
@ldionne +1 |
I meet exactly the same issue about cost of inclusion of |
Right now, containers are documented as not supporting references at all. First, this should be changed because most containers are able to hold references. Furthermore, it would be nice to add support for
reference_wrapper
inmake_tuple
, likestd::make_tuple
. Specifically,hana::make_tuple(std::ref(x))
should create ahana::tuple<X&>
instead of ahana::tuple<std::reference_wrapper<X>>
.Things I'm worried about:
make_tuple
. This will have to be benchmarked to be sure.<functional>
in such a fundamental header. This has to be benchmarked too, and we can probably cheat with a forward declaration otherwise.As a motivating example for this feature, consider the following:
Containers that should probably support this feature if we decide to go forward:
tuple
set
map
pair
optional
lazy
?As for
basic_tuple
, I think it is better to keep it as basic as possible for performance reasons. I don't think anybody usingbasic_tuple
would expect that kind of sugar anyway.The text was updated successfully, but these errors were encountered: