Subject: Re: [boost] Heads up - string_ref landing
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-11-16 08:26:28
On 16/11/12 10:33, Olaf van der Spek wrote:
> On Fri, Nov 16, 2012 at 10:28 AM, Yanchenko Maxim
> <maximyanchenko_at_[hidden]> wrote:
>> 16.11.12, 12:30, "Olaf van der Spek":
>>>>> OTOH size is needed very frequently and having it precomputed is a good thing, so conversion
>>> Size is cheap to calculate, it's not worth storing it.
>>> Standardizing the layout of this type might be good too for ABI
>>> stability and maybe interoperability.
>> Yes, it's cheap to calculate (end ptr is equally cheap to calculate btw) but you'll end up calculating it all the time in almost every function. At least my analysis showed that in real app size() is called much more frequently than end().
> Really? Do you use subscripted access then? With iterator access you'd
> use end().
Most of std::string member functions (which are replicated in
string_ref) use a subscript interface.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk