Boost logo

Boost :

Subject: Re: [boost] Heads up - string_ref landing
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-11-16 04:24:33


On Fri, Nov 16, 2012 at 9:52 AM, Antony Polukhin <antoshkka_at_[hidden]> wrote:
> 2012/11/16 Andrey Semashev <andrey.semashev_at_[hidden]>:
>>> +1 for having corresponding explicit converting ctors/operators.
>>
>> Shouldn't they be implicit?
>>
>> void f(str_ref);
>>
>> string s = "Olaf";
>> f(s);
>
> Looks nice. And what about constructors from std::array?

It should be implicitly constructable from any contiguous (char) range.

> BTW, I'd like to see a std::basic_string to_string()/str() and
> std::array to_array()/array() member functions.

Why member functions?
Array is fixed size, str_ref isn't. How would you handle a size mismatch?

-- 
Olaf

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