[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: auto and const_iterators
From: |
Rik |
Subject: |
Re: auto and const_iterators |
Date: |
Wed, 2 May 2018 15:22:34 -0700 |
On 05/02/2018 03:10 PM, John W. Eaton wrote:
> On 05/02/2018 06:06 PM, Rik wrote:
>> On 05/02/2018 02:52 PM, John W. Eaton wrote:
>>>
>>> Either solution is OK with me, but I see more lines that remove
>>> const_iterator than iterator. Are the only ones we have to change the
>>> ones where the object itself is not const but we were accessing elements
>>> with a const_iterator?
>>
>> That's right. It's only when we want to confirm to the compiler that the
>> access should be read-only which is only necessary for a mutable object.
>> If the entire object is const already then all accesses are necessarily
>> read-only.
>
> OK, I can fix this, but is there an easier way to find them other than
> manually looking at each of the instances where a const_iterator
> declaration was replaced by auto?
Unfortunately, I don't think so :(
--Rik