From 3103981485472894374
X-Google-Thread: f78e5,1b54f9c683bc95c5,start
X-Google-NewGroupId: yes
X-Google-Attributes: gid7894ca11fe,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.68.129.169 with SMTP id nx9mr10932806pbb.8.1326818140709;
        Tue, 17 Jan 2012 08:35:40 -0800 (PST)
MIME-Version: 1.0
Path: lh20ni192876pbb.0!nntp.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!news2.euro.net!amsnews11.chello.com!nuzba.szn.dk!pnx.dk!news.albasani.net!.POSTED!not-for-mail
From: vlad.moscow@mail.ru
Newsgroups: comp.std.c++
Subject: Absence of global functions std::cbegin() and std::cend()
Date: Tue, 17 Jan 2012 08:33:59 -0800 (PST)
Organization: http://groups.google.com
Lines: 29
Sender: std-cpp-request@vandevoorde.com
Approved: stephen.clamage@oracle.com
Message-ID: <d69d85dc-877f-4fcd-92f4-637629e79be6@w4g2000vbc.googlegroups.com>
NNTP-Posting-Host: UFsJMYbzDJw0+w8jQC5xabO2CO3kObBBDn/ePzxThFU=
X-Trace: news.albasani.net rjmq4DRWKQmf7MphwE8JrSF47uLWig4bP8yAGrwndKA0Ni4tcDKiZrgnGwlqDcpxNkRdnJsc8AVjx29mlS44YQ==
X-Complaints-To: abuse@albasani.net
NNTP-Posting-Date: Tue, 17 Jan 2012 16:35:40 +0000 (UTC)
X-Mailer: Perl5 Mail::Internet v2.05
X-Submission-Address: std-cpp-submit@vandevoorde.com
Cancel-Lock: sha1:Pz6fGov5uyOuFZxLmV88y52kYHY=
X-Original-Date: Mon, 16 Jan 2012 16:10:22 -0800 (PST)
Content-Type: text/plain; charset=ISO-8859-1

Along with global functions std::begin() and std::end() there should
be their visavis in the C++ Standard: global functions std::cbegin()
and std::cend() which return const_iterator for containers or pointers
to constant arrays.

For example

#include<iostream>
#include<algorithm>
#include<iterator>

int main()
{
    const int a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

    std::vector<int>  v( std::cbegin( a ), std::cend( a ) );

    std::copy( std::cbegin( a ), std::cend( a ),
std::ostream_iterator<int>( std::cout, " " ) );
    std::copy( std::cbegin( v ), std::cend( v ),
std::ostream_iterator<int>( std::cout, " " ) );
}


-- 
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]


