Subject: Re: [boost] Heads up - string_ref landing
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-11-26 08:26:13
On Mon, Nov 26, 2012 at 4:52 PM, Daniel James <dnljms_at_[hidden]> wrote:
> On 26 November 2012 11:56, Andrey Semashev <andrey.semashev_at_[hidden]> wrote:
>> The problem with std::string is the same as with string_ref - it
>> doesn't support implicit construction from an arbitrary range, so my
>> examples with custom string types would still not work.
> Shouldn't construction from an arbitrary range be explicit? Arbitrary
> implicit conversions are problematic. To get implicit construction
> from third party strings, I'd use some sort of explicit customisation
If the string_ref or range type (let's call it contiguous_range< const
char* >) is not implicitly convertible from other string types then it
is useless for use cases I pointed out. The thing is to make
interfaces transparently support any string types.
As a side note, I wonder if it should be contiguous_range< const char*
> or contiguous_range< const char >? Since the range is contiguous, we
can always store pointers internally, even if the referred range has
other iterator types (e.g. std::vector).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk