Boost logo

Boost :

Subject: Re: [boost] [string_ref] [utility] Add string_view?
From: Nevin Liber (nevin_at_[hidden])
Date: 2015-07-08 19:00:34


On 8 July 2015 at 11:54, Marshall Clow <mclow.lists_at_[hidden]> wrote:

> On Wed, Jul 8, 2015 at 9:15 AM, Nevin Liber <nevin_at_[hidden]>
> wrote:
>
> > On 8 July 2015 at 09:43, Marshall Clow <mclow.lists_at_[hidden]> wrote:
> >
> > > >>> I'd really like to see the final TS basic_string_view added to
> Boost
> > so
> > > >>> I can start using it now.
> > > >>>
> > > >>>
> > > use a typedef for now; and I'll update the boost implementation post
> 1.59
> > > release.
> > >
> >
> > You can't use a typedef; it's a template.
> >
> > You can use a "using" clause, but that requires C++11 or later.
> >
> >
> string_ref is a real type; it's a specialization of basic_string_ref, which
> is a template.
>
> typedef basic_string_ref<char, std::char_traits<char> >
> string_ref;
>

Is the final goal to have boost::*string_view and boost::*string_ref
removed?

Right now, I have code that takes both std::experimental::string_view and
boost::string_ref in interfaces, so the typedef doesn't change anything. I
also have code that uses std::experimental::basic_string_view and
boost::basic_string_ref, and the typedef doesn't work.

Sure, we can add typedefs for the four concrete types, but I don't know if
there really is an audience who needs that, if the interface isn't the one
which matches the TS. The other downside to a typedef is that people can
use string_view and string_ref interchangeably, which can lead to porting
problems in the future.

-- 
 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

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