int/uint -> size_t

Mainly made loop indices of type size_t ensuring they don't become
negative and removing signed-unsigned comparisons as std::vector.size()
always returns a size_t.

Also added assertions at a few points to ensure consistency.

Had to use an explicit cast of size_t to int at a few points.
cmake: add -Wextra and -Wpedantic

as default compiler arguments
a few std::vector tweaks ([0] -> .front(); [size-1] -> .back())
finished templatization
C++ constructor syntax for explicit casts

not C-style syntax
Merge pull request #1 from torbjoernk/feature/template-time

finished the templates and added some further improvements