Adding numpy count_nonzero & minor template fix

Have i missed something?
the bool operator should be ovelroaded correctly, so
```
if(*begin)
```

should be enough