Urs Thuermann wrote:
> Marc <> writes:
>
>> Juha Nieminen wrote:
>>
>> > Ian Collins <ian-> wrote:
>> >> Only if your compiler supports the new auto keyword. Otherwise use a
>> >> typedef for the parameter type.
>> >
>> > Would decltype(container)::iterator work in C++0x?
>>
>> C++11 now. Yes, but it would be easier to just write:
>> auto it=ilist.begin();
>
> Ok, that looks nice and GCC already supports it. Is it also possible
> to define a const_iterator from a non-const container object using the
> auto keyword, i.e. a list<T>::const_iterator from an object of type
> list<T>?
Yes, call cbegin instead of begin ('c' for "const").
|