C++ Logo

SG10

Advanced search

Subject: Re: [SG10] P0272: non-const string data
From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2016-03-11 16:02:14


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


SG10 list run by herb.sutter at gmail.com