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

Adding parallel::destroy and destroy_n #2676

Merged
merged 4 commits into from Jun 9, 2017
Merged

Adding parallel::destroy and destroy_n #2676

merged 4 commits into from Jun 9, 2017

Conversation

hkaiser
Copy link
Member

@hkaiser hkaiser commented Jun 2, 2017

This is related to #1141


for (/* */; first != last; ++first)
{
std::addressof(*first)->~value_type();
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need std::addressof here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because the type returned from dereferencing first could have an overloaded operator&(). Alternatively we could write (*first).~value_type(), however MSVC was complaining about this for some unknown reason.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, the question was hinting at why not to use (*first).~value_type() in the first place, MSVC not working is anwering that, thanks!

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.

LGTM

@hkaiser hkaiser added this to Work in progress in Standard Algorithms Jun 8, 2017
@hkaiser hkaiser merged commit 179850d into master Jun 9, 2017
@hkaiser hkaiser deleted the parallel_destroy branch June 9, 2017 13:52
std::for_each(p, p + data_size,
[&count](destructable v1)
{
HPX_TEST_EQ(v1.value_, (std::uint32_t)0xcdcdcdcd);
Copy link
Member

Choose a reason for hiding this comment

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

This is technically UB, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is... Do you have a better idea how to check whether an object actually was destroyed? We could perhaps simply use a counter to count invocations. Not sure.

@sithhell
Copy link
Member

sithhell commented Jun 16, 2017 via email

@hkaiser
Copy link
Member Author

hkaiser commented Jun 23, 2017

@sithhell: see #2709 for a fix

@hkaiser hkaiser moved this from Work in progress to Merged to master in Standard Algorithms Jul 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Standard Algorithms
  
Merged to master
Development

Successfully merging this pull request may close these issues.

None yet

2 participants