Boost logo

Boost :

Subject: Re: [boost] [string_ref] string literal constructor
From: Jonathan Wakely (jwakely.boost_at_[hidden])
Date: 2013-11-03 17:07:28


On 2 November 2013 10:27, Domagoj Saric wrote:
> On 2.11.2013. 0:42, Michael Marcin wrote:
>>
>> I noticed string_ref doesn't have a constructor for a string literal.
>> Wouldn't this save a call to strlen for a common case?
>
>
> You first have to find a compiler that does not already eliminate the strlen
> ;)

Indeed, the strlen call on a string literal can (and should) be
optimised away, so the current constructor should already produce the
optimal result.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk