From 1003322106215175769
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: Nikolay Ivchenkov <tsoae@mail.ru>
Newsgroups: comp.std.c++
Subject: Re: No cbegin/cend for std::initializer_list?
Date: Tue,  1 Sep 2009 23:14:50 CST
Organization: http://groups.google.com
Lines: 18
Sender: cppmods@cs.rpi.edu
Approved: james.dennett@gmail.com
Message-ID: <1b8b2c5d-7f06-46c5-b403-50aad13632cf@o36g2000vbl.googlegroups.com>
References: <7.0.0.16.2.20090901101108.063e9c28@aristeia.com>
NNTP-Posting-Host: netlab.cs.rpi.edu
Content-Type: text/plain; charset=ISO-8859-1
To: (Usenet)
Return-Path: <cppmods@ruralroute.cs.rpi.edu>
X-Original-Date: Tue, 1 Sep 2009 12:43:49 -0700 (PDT)
X-Submission-Address: std-c++@netlab.cs.rpi.edu
Xref: g2news2.google.com comp.std.c++:1334

On 1 Sep, 22:39, Scott Meyers <smey...@aristeia.com> wrote:
> but offering cbegin/cend would make it easier to write generic code

I think that generic code should use more general approach. N2930
proposes functions "begin" and "end" to be added to namespace std. I
think, there shall be also "cbegin", "cend", "rbegin", "rend",
"crbegin", and "crend" versions. Supposed std::cbegin can be applied
to built-in arrays in the same manner as to class-containers, and it
can work fine with old containers those don't have member function
"cbegin". IMHO, direct use of container's member "cbegin" in generic
code is bad idea.

--
[ 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                      ]



