SwapTable implementation using templates. With tests.