Date: Tue, 18 Jan 2022 12:09:30 -0600
On Tue, Jan 18, 2022 at 12:03 PM Peter Dimov via SG7 <sg7_at_[hidden]>
wrote:
> Daveed Vandevoorde wrote:
> > > On Jan 18, 2022, at 11:53 AM, Peter Dimov via SG7 <
> sg7_at_[hidden]>
> > wrote:
> > >
> > >> Daveed Vandevoorde wrote:
> > >>> — The proposed metafunctions now use span and string_view instead
> > >> of
> > >>> vector and string
> > >>
> > >> NTCS please :-(
> > >
> > > I'm serious. Please provide a way to obtain a `char const*` instead of
> > > std::string_view; that could take the form of a consteval magic
> > > function taking the std::string_view returned from the official API.
> > >
> > > Since the compiler will not want to be married to a particular stdlib,
> > > its internal primitives are not going to be creating std::string_views
> > > anyway.
> >
> >
> > I missed this before. We could return a NTCS instead: Would that be more
> > usable? It’s certainly easier to implement.
>
> It's unfortunately not more usable. With a string_view, you can write
> `name_of(x) == "f"` and have it work correctly.
>
> But on the other hand, if you have a `char const*`, it's trivial to obtain
> a
> string_view from it, whereas the reverse... isn't.
>
> So I can't with a clear conscience insist on changing the API to return
> `char const*` because this degrades usability for simple things (even if
> that doesn't occur very often outside of toy examples), but I would very
> much like _some_ way of obtaining a `char const*`.
>
Is this when we finally get zstring_view?
Barry
wrote:
> Daveed Vandevoorde wrote:
> > > On Jan 18, 2022, at 11:53 AM, Peter Dimov via SG7 <
> sg7_at_[hidden]>
> > wrote:
> > >
> > >> Daveed Vandevoorde wrote:
> > >>> — The proposed metafunctions now use span and string_view instead
> > >> of
> > >>> vector and string
> > >>
> > >> NTCS please :-(
> > >
> > > I'm serious. Please provide a way to obtain a `char const*` instead of
> > > std::string_view; that could take the form of a consteval magic
> > > function taking the std::string_view returned from the official API.
> > >
> > > Since the compiler will not want to be married to a particular stdlib,
> > > its internal primitives are not going to be creating std::string_views
> > > anyway.
> >
> >
> > I missed this before. We could return a NTCS instead: Would that be more
> > usable? It’s certainly easier to implement.
>
> It's unfortunately not more usable. With a string_view, you can write
> `name_of(x) == "f"` and have it work correctly.
>
> But on the other hand, if you have a `char const*`, it's trivial to obtain
> a
> string_view from it, whereas the reverse... isn't.
>
> So I can't with a clear conscience insist on changing the API to return
> `char const*` because this degrades usability for simple things (even if
> that doesn't occur very often outside of toy examples), but I would very
> much like _some_ way of obtaining a `char const*`.
>
Is this when we finally get zstring_view?
Barry
Received on 2022-01-18 18:09:43