On Sat, Jun 20, 2015 at 4:17 PM, Louis Dionne
Zach Laine
writes: On Thu, Jun 18, 2015 at 4:27 PM, Louis Dionne
wrote:
[...]
To get there, I'd like to make sure I understand exactly what operation you're trying to avoid. Let's assume you wrote the following instead of a transform_mutate equivalent:
hana::tuple
xs{...}; hana::tuple ys; ys = hana::transform(xs, f); This will first apply f() to each element of xs(), and then store the temporary values in a (temporary) tuple by moving them into place. This will then move-assign each element from the temporary tuple into ys.
__Is the first move what you are trying to avoid?__
No, I'm trying to get rid of the temporary altogether. We all know that copies of temporaries get RVO'd out of code like the above a lot of the time, *but not always*. I want a guarantee that I don't need to rely on RVO in a particular case, if efficiency is critical.
Sorry I'm being so slow, but do you mean get rid of the temporary tuple or the temporary value? Regarding the temporary value,
Not this. [snip]
I'll take it that you want to get rid of the temporary tuple.
This. Zach