SwapTable implementation using templates. With tests.

tru. poprawione.