Boost logo

Boost :

Subject: Re: [boost] Heads up - string_ref landing
From: Yanchenko Maxim (maximyanchenko_at_[hidden])
Date: 2012-11-27 01:44:37


27.11.12, 14:24, "Andrey Semashev" <andrey.semashev_at_[hidden]>":
>
> +1, string_ref by definition doesn't own the referred characters. Its
> presence is enough indication that the storage of the characters has
> to be managed elsewhere.

Unfortunately there is absolutely no indication of its presence if you make the construction implicit. Implicitly constructible types are invisible at the point of use, this is the problem.
This is exactly what I'm talking about: there should be clear indication of what's going on, and it should be at the point of use, not in function declaration or in docs.
Making it implicit is a way to error-prone user code.

> And from the user's perspective it should be as transparent as possible.

What about making implicit conversion from auto_ptr<T*> to T*? Enforcing use of get() is not transparent as possible either.
What about getting rid of c_str()?
Isn't safety the reason of having both?

Thanks,
Maxim


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