initializer_list: const reference.

Bo Persson bop@gmb.dk
Sun Nov 15 13:43:00 GMT 2009


Thiago Farina wrote:

> Hi,
>
> Reading the source code of initializer_list, I saw that the
> definition
> of reference is:
>
> typedef const _E& reference;
>
> Why it was declared as const? Is there a reason for this? Also
> already exists a const_reference with the same declaration.
>
> Please keep me in the CC list, because I'm not subscribed to the
> list yet.

The iterator and the const_iterator are both constants iterators, just 
like for some of the assosiative containers. That's just what the 
standard prescribes.


Bo Persson



More information about the Libstdc++ mailing list