It does using a mask vector with entries 0 or 1. If that is not provided it falls back to std::accumulate.