From -7413078336262946692
X-Google-Thread: 7894ca11fe,b8f03ff37c64f88c,start
X-Google-Attributes: gid7894ca11fe,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news2.google.com!news.glorb.com!news.alt.net!frodo.cs.rpi.edu!not-for-mail
From: Scott Meyers <smeyers@aristeia.com>
Newsgroups: comp.std.c++
Subject: No cbegin/cend for std::initializer_list?
Date: Tue,  1 Sep 2009 12:39:58 CST
Organization: unknown
Lines: 22
Sender: cppmods@cs.rpi.edu
Approved: austern@google.com
Message-ID: <7.0.0.16.2.20090901101108.063e9c28@aristeia.com>
NNTP-Posting-Host: netlab.cs.rpi.edu
Content-Type: text/plain; charset="us-ascii"
To: (Usenet)
Return-Path: <cppmods@ruralroute.cs.rpi.edu>
X-Original-Date: Tue, 01 Sep 2009 10:18:27 -0700
X-Submission-Address: std-c++@netlab.cs.rpi.edu
Xref: g2news2.google.com comp.std.c++:1332

The initializer_list spec in N2914 provides iterators via begin/end,
but it fails to offer cbegin/cend.  There is no loss of functionality
here, because begin/end return const_iterators, but offering
cbegin/cend would make it easier to write generic code and would
encourage people to develop a habit of using cbegin/cend when they
perform iterators that don't mutate the elements being iterated over.
 Is there a reason not to add cbegin/cend to iterator_list?

As an aside, iterator list declares typedefs for iterator and
const_iterator, but it doesn't use them in the specification of
begin/end, which are spec'd to return raw pointers.  This seem, um,
less than ideal.

Scott


--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



