The author has a fork of clang and gcc with some pretty impressive speedups, so I’m hopeful! https://lists.isocpp.org/sg14/2024/04/1127.php
https://en.cppreference.com/w/cpp/named_req/Allocator
But regardless, realloc() can't be used to implement the optimisation efficiently because of this line from the C man page:
> The realloc() function returns a pointer to the newly allocated memory, which is suitably aligned for any kind of variable *and may be different from ptr*
Basically, if the implementation can't extend the memory allocation it can fallback to malloc(), memcpy() and free() - so by the time C++ gets control back, it's too late to call the appropriate C++ functions.
https://en.cppreference.com/w/cpp/types/is_trivially_copyabl...