Proposal: Expand existing allowance for std::begin() and end() to cover cbegin() and cend()

21 views
Skip to first unread message

Peter Kasting

unread,
Feb 2, 2016, 10:57:25 PM2/2/16
to cxx
We allow std::begin() and std::end() (nonmember iterators) but cbegin() and cend() are still TBD.  To me these two seem to go together and if we allow one we might as well allow the other.

I don't have a potential CL that would use this since std::begin() and std::end() themselves are a bit rare, so this is motivated more by principle (and wanting to reduce the number of rows in the feature list tables on the website) than explicit immediate need.

PK

Vladimir Levin

unread,
Feb 3, 2016, 1:54:08 PM2/3/16
to Peter Kasting, cxx
I believe that non-member cbegin/cend were introduced in C++14.

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To post to this group, send email to c...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAAHOzFA%3D7qttYpNPowH9sWSPi_jcBM1bR3QczHxdt977eKDNbw%40mail.gmail.com.

Peter Kasting

unread,
Feb 3, 2016, 5:58:13 PM2/3/16
to Vladimir Levin, cxx
On Wed, Feb 3, 2016 at 10:54 AM, Vladimir Levin <vmp...@google.com> wrote:
I believe that non-member cbegin/cend were introduced in C++14.

I think you're right.  I tried to check this before sending my mail but I misread the table of versions.

We probably don't want to allow this, then, and we probably also want to remove it from the table of C++11 features to discuss since it's not a C++11 feature.  Any comments on that plan?

PK 

Dana Jansens

unread,
Feb 3, 2016, 6:00:08 PM2/3/16
to Peter Kasting, Vladimir Levin, cxx
Ya, let's not keep C++14 things in that list.
 

PK 

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To post to this group, send email to c...@chromium.org.

Vladimir Levin

unread,
Feb 3, 2016, 6:46:32 PM2/3/16
to Dana Jansens, Peter Kasting, cxx
On Wed, Feb 3, 2016 at 2:59 PM, Dana Jansens <dan...@chromium.org> wrote:
On Wed, Feb 3, 2016 at 2:58 PM, 'Peter Kasting' via cxx <c...@chromium.org> wrote:
On Wed, Feb 3, 2016 at 10:54 AM, Vladimir Levin <vmp...@google.com> wrote:
I believe that non-member cbegin/cend were introduced in C++14.

I think you're right.  I tried to check this before sending my mail but I misread the table of versions.

We probably don't want to allow this, then, and we probably also want to remove it from the table of C++11 features to discuss since it's not a C++11 feature.  Any comments on that plan?

Ya, let's not keep C++14 things in that list.

The list of features to discussed has "Constant Iterator Methods on Containers". I read that as something like std::vector<T>::cbegin, which _was_ introduced in C++11. 

Dana Jansens

unread,
Feb 3, 2016, 6:56:10 PM2/3/16
to Vladimir Levin, Peter Kasting, cxx
On Wed, Feb 3, 2016 at 3:46 PM, Vladimir Levin <vmp...@google.com> wrote:


On Wed, Feb 3, 2016 at 2:59 PM, Dana Jansens <dan...@chromium.org> wrote:
On Wed, Feb 3, 2016 at 2:58 PM, 'Peter Kasting' via cxx <c...@chromium.org> wrote:
On Wed, Feb 3, 2016 at 10:54 AM, Vladimir Levin <vmp...@google.com> wrote:
I believe that non-member cbegin/cend were introduced in C++14.

I think you're right.  I tried to check this before sending my mail but I misread the table of versions.

We probably don't want to allow this, then, and we probably also want to remove it from the table of C++11 features to discuss since it's not a C++11 feature.  Any comments on that plan?

Ya, let's not keep C++14 things in that list.

The list of features to discussed has "Constant Iterator Methods on Containers". I read that as something like std::vector<T>::cbegin, which _was_ introduced in C++11. 

Good point. Well, let's clarify things. https://codereview.chromium.org/1669683002/

Peter Kasting

unread,
Feb 3, 2016, 7:11:09 PM2/3/16
to Dana Jansens, Vladimir Levin, cxx
On Wed, Feb 3, 2016 at 3:55 PM, Dana Jansens <dan...@chromium.org> wrote:
On Wed, Feb 3, 2016 at 3:46 PM, Vladimir Levin <vmp...@google.com> wrote:


On Wed, Feb 3, 2016 at 2:59 PM, Dana Jansens <dan...@chromium.org> wrote:
On Wed, Feb 3, 2016 at 2:58 PM, 'Peter Kasting' via cxx <c...@chromium.org> wrote:
On Wed, Feb 3, 2016 at 10:54 AM, Vladimir Levin <vmp...@google.com> wrote:
I believe that non-member cbegin/cend were introduced in C++14.

I think you're right.  I tried to check this before sending my mail but I misread the table of versions.

We probably don't want to allow this, then, and we probably also want to remove it from the table of C++11 features to discuss since it's not a C++11 feature.  Any comments on that plan?

Ya, let's not keep C++14 things in that list.

The list of features to discussed has "Constant Iterator Methods on Containers". I read that as something like std::vector<T>::cbegin, which _was_ introduced in C++11. 

Good point. Well, let's clarify things. https://codereview.chromium.org/1669683002/

Yeah, thanks, this is clearer.

I still think we should go ahead and allow these since I see no downside to having them, but since I don't have any particular need to use them personally, I won't post further here.

PK 

Dana Jansens

unread,
Feb 3, 2016, 7:13:09 PM2/3/16
to Peter Kasting, Vladimir Levin, cxx
I'd also be happy with allowing them if someone had a CL that benefited from them to land along with the styleguide change.

Peter Kasting

unread,
Feb 10, 2016, 10:55:10 PM2/10/16
to cxx
Reply all
Reply to author
Forward
0 new messages