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

invocation_wrapper: support non-POD types using placement new #115

Merged
merged 1 commit into from
May 9, 2022

Conversation

pcolberg
Copy link
Contributor

@pcolberg pcolberg commented May 6, 2022

Each context maintains a pool of manually allocated invocation_wrapper
objects, which so far contained only POD types. To support the use of
non-POD types, e.g., std::vector, explicitly invoke the constructor
using placement new after malloc, and the destructor before free.

https://en.cppreference.com/w/cpp/language/new#Placement_new
#103 (comment)

@pcolberg pcolberg added the bug Something isn't working label May 6, 2022
@pcolberg pcolberg added this to the 2022.3 milestone May 6, 2022
@pcolberg pcolberg self-assigned this May 6, 2022
@pcolberg pcolberg requested a review from zibaiwan May 6, 2022 20:39
@pcolberg pcolberg force-pushed the invocation_wrapper branch from 99b3b2a to 7245f91 Compare May 6, 2022 22:17
Each context maintains a pool of manually allocated invocation_wrapper
objects, which so far contained only POD types. To support the use of
non-POD types, e.g., std::vector, explicitly invoke the constructor
using placement new after malloc, and the destructor before free.

https://en.cppreference.com/w/cpp/language/new#Placement_new
intel#103 (comment)

Signed-off-by: Peter Colberg <peter.colberg@intel.com>
@pcolberg pcolberg force-pushed the invocation_wrapper branch from 7245f91 to 9a30756 Compare May 7, 2022 01:06
Copy link
Contributor

@zibaiwan zibaiwan left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks Peter!

@pcolberg pcolberg merged commit 4febd02 into intel:main May 9, 2022
@pcolberg pcolberg deleted the invocation_wrapper branch May 9, 2022 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants