Correct #includes, and remove unneeded ones

The missing #include for <array> was a bug.  The code up to this
revision compiles with g++-4.8, but not g++-4.7.
Turn on -Wall, and enable optimisation

Also corresponding changes to correct a couple of warnings.
Some defensive static asserts, and delete a copy constructor