I would like to align a region of memory which will be used for storage to a specific power-of-two alignment using std::align
1.
This will apparently invoke UB if the alignment value isn't a fundamental or extended alignment value. Is there any way to check at compile-time (e.g., a static_assert
) or at runtime whether the value I want to use is supported?
1 To be clear, I'm also open to std::alignas
or std::aligned_storage
if they are more flexible or otherwise allow me to safely check what is supported.