C++ Logo

sg10

Advanced search

Re: [SG10] P0272: non-const string data

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Fri, 11 Mar 2016 23:02:14 +0100
On 03/11/2016 08:08 PM, Nelson, Clark wrote:
> The paper proposing a new overload for string::data didn't propose a
> feature-test macro.
>
> The first question is, would one be useful for it?

For
   s.data()

the workaround is something like

   &s[0]

(Both const and non-const.)

For someone trying to be backward-compatible, I can't see
why you'd perform an #ifdef dance to be able to write
s.data().

Jens

Received on 2016-03-11 23:02:22