Created
November 22, 2022 06:57
-
-
Save CyberDNIWE/83a56cc15627580ba42d6aa51417b3cd to your computer and use it in GitHub Desktop.
poorly::aligned_storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Equivalent to std::aligned_storage (taken from https://gist.github.com/calebh/fd00632d9c616d4b0c14e7c2865f3085) | |
namespace poorly | |
{ | |
template<unsigned int Length, unsigned int Alignment> | |
struct aligned_storage | |
{ | |
struct type | |
{ alignas(Alignment) unsigned char data[Length]; }; | |
}; | |
}; | |
// Usage: | |
// using data_t = poorly::aligned_storage<sizeof(int), alignof(int)>; | |
// data_t intWorthOfBytes = data_t(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment