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

Alignment typed storage #1023

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rolandreichweinbmw
Copy link

I have a recurring use case of globally allocated class instances that I need to explicitly construct in a more defined order than implicit construction of global C++ objects can offer.

Therefore, I have a convenience wrapper etl::typed_storage for aligned_storage_as for instantiating an object explicitly at a defined time.

Previously, I tried with etl::optional, which basically supports the same interface I need, but I can't use this one because it always references ~T. But I want the compiler to optimize away the unneeded dtors because the global objects won't get destroyed anyway until power-off in many embedded scenarios.

(You can still explicitly destroy() if needed.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

2 participants