|
Boost : |
From: David Bien (davidbien_at_[hidden])
Date: 2022-05-13 17:42:27
I guess when I read the impl I think to myself: What this is missing is a _length member. But then it just becomes boost::string_view.
What value added is there to this impl except that it is smaller than boost::string_view due to lacking a _length member?
bien
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
From: Seth via Boost<mailto:boost_at_[hidden]>
Sent: Friday, May 13, 2022 6:35 AM
To: Boost List<mailto:boost_at_[hidden]>
Cc: Seth<mailto:bugs_at_[hidden]>
Subject: Re: [boost] cstring_view
> I dont see how this is supposed to maintain the invariant ( null
> temination) w/o its own storage.
I had similar concerns, but then I looked at the code, and ... you know, it answers the question.
>
> Consider:
> cstring_view sv; // is sv-data() pointing to a null-terminated
> string? If so, where did it come from?
The appriopriate static character literal.
> cstring_view sv1(abcdefg)
> sv1.substring(3, 2); // whats the value of strlen(sv.data) here?
> How can it be 2?
Length-constrained substring returns string_view.
Seth
_______________________________________________
Unsubscribe & other changes: https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.boost.org%2Fmailman%2Flistinfo.cgi%2Fboost&data=05%7C01%7C%7C141fb49e0d234e9caaeb08da34dd0902%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637880421205777221%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8WFpXM5V3QPhS41DiX1E%2BU8IOfM58Nc1JJ5ct%2F0ImpQ%3D&reserved=0
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk