uses std::swap to swap indices

Signed-off-by: tgfrerer <tim@poniesandlight.co.uk>