use fill_n instead of memset

I guess this is the preferred c++ method to do this.

Fixes up 1c142991acad0800b74ae39ee729b36ff1f4a2ef