user336635
user336635

Reputation: 2281

Qt's iterators - are they all const?

I'm doing:
QMap<QString,Qt::CheckState>::iterator beg = data_.begin();//here data_ is of type QMap<QString,Qt::CheckState>
and qt tells me:
error: conversion from 'QMap::const_iterator' to non-scalar type 'QMap::iterator' requested

Why? I didn't asked for cbegin, so what's the story with this?

Upvotes: 0

Views: 418

Answers (1)

Moo-Juice
Moo-Juice

Reputation: 38800

Sounds like data_ is const at this point in time, so the const version of begin() will be called. :)

Upvotes: 2

Related Questions