I think "just as well" elides maintainability... I would not want to have to debug a generic sorter written in c preprocessor.
It's a bit brittle of course to depend too much on the optimizer, but the whole idea of "zero cost abstraction" in C++ also puts a lot of trust into the optimizer passes.