Use STL algorithm instead of this cycle (unnecessarily)