Namespaces
Variants
Views
Actions

Talk:cpp/string/basic string/data

From cppreference.com

> Specifically the pointer is such that range [data(); data() + size()) is a valid.

Proposed change:

Specifically, the pointer is such that the range [data(), data() + size()) is valid, even when empty returns true.

[edit] Since C++11

The summary distinguishes between C++11 and earlier in sentence starting with 'The pointer is such that the range...'. But the range mentioned is identical for 'until C++11' and 'since C++11'. I guess the latter should be [data(); data() + size()+1]? --Bear (talk) 03:09, 12 April 2021 (PDT)

The difference is the first range is half open, whilst the second range is closed --Ybab321 (talk) 09:02, 12 April 2021 (PDT)
Thanks for clarifying --Bear (talk) 10:36, 12 April 2021 (PDT)