Add .swp to .gitignore
Use return value class template to avoid casting return value to possibly incompatible type