it has no sence to use cbegin in such context. you've already definded iterator as const. cbegin is usefull with keyword auto.