Skip to content
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

Add C++11 range utilities #2734

Merged
merged 5 commits into from Jul 6, 2017
Merged

Add C++11 range utilities #2734

merged 5 commits into from Jul 6, 2017

Conversation

K-ballo
Copy link
Member

@K-ballo K-ballo commented Jul 2, 2017

No description provided.

Copy link
Member

@sithhell sithhell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you measure any compile time improvements with this patch?

{
Range values_ = traits::acquire_future<Range>()(values);
return lcos::when_all(std::move(values_));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the rationale to drop this overload?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overload becomes redundant, given the changes to the overload above.

typedef typename frame_type::init_no_addref init_no_addref;

boost::intrusive_ptr<frame_type> p(new frame_type(
util::forward_as_tuple(std::move(values)), init_no_addref()),
util::forward_as_tuple(std::move(lazy_values_)), init_no_addref()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we rather std::forward the lazy values?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. That might have made some sense (not really) back when std::vector was the only thing accepted as a range, but now the function will accept non-owning ranges as well, and needs to acquire the shared states explicitly so as to guarantee they stay alive long enough.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I am a little confused. The function takes a forwarding reference, yet you move it unconditionally. How does it work? Wouldn't when_all_frame capture it correctly even if it was forwarded?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't move from the argument lazy_values, but from a local lazy_values_ initialized by acquiring all the futures in the range given as argument. This is rather subtle, but a common pattern within the whens.

That said, it looks like the implementation of acquire_future might be insufficient to properly support non-owning ranges. I'll have to look into that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, thanks for the clarification. I missed the underscore...

@K-ballo
Copy link
Member Author

K-ballo commented Jul 3, 2017

Did you measure any compile time improvements with this patch?

No, no measurement was performed. Compile time improvements is not the rationale of this PR, though it'd be a colorful datapoint to have if someone's interesting in doing the work.

@sithhell
Copy link
Member

sithhell commented Jul 3, 2017

Yes, I can see that a reduction of compile times wasn't the point here. A difference in compile times would be interesting nonetheless.

Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@hkaiser hkaiser merged commit f819772 into master Jul 6, 2017
@hkaiser hkaiser deleted the range branch July 6, 2017 19:18
taeguk added a commit to taeguk/hpx that referenced this pull request Jul 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants