I've noticed std::aligned_alloc()
coming into C++17, and I like it. But - what happens when I need to reallocate? I can do this manually (assuming the available space at the currently-allocated address is just the amount of space I asked for), but shouldn't there be a facility for this in the standard library?
There isn't such standard call equivalent.
Even more so, Microsoft's latest implementation of C++ still has its own _aligned_malloc()
instead of the now standardized std::aligned_alloc()
, and here they explain why:
aligned_alloc() will probably never be implemented, as C11 specified it in a way that’s incompatible with our implementation (namely, that free() must be able to handle highly aligned allocations).
Among their (Microsoft's) underscore-prefixed implementations they do serve you with _aligned_realloc()
:-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With