common:swap_generic

Generic method to implement swap, which could swap any kind of
elements.

Signed-off-by: guofengliu <lgf612@sina.com>