wxString support for string_view?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
beneficii
Earned some good credits
Earned some good credits
Posts: 111
Joined: Fri Nov 27, 2009 2:49 am

wxString support for string_view?

Post by beneficii »

I've read about a new class coming out in the C++ Standard Library this year called std::basic_string_view, which with char[] is std::string_view, with wchar_t[] is std::wstring_view, with char16_t[] is std::u16string_view, and with char32_t[] is std::u32string_view. It's great for having to pass strings to functions which need only to read them without taking ownership of them. It works especially well for parsers, in that you can keep narrowing the range of the string_view and make recursive function calls without having to make copies of the string, get the successive functions take ownership of the string, or work with pointer arithmetic that goes to dealing with double pointers, which is easy to shoot yourself in the foot with.

I could see something like a wxStringView, though I'm not sure how wxString stores its character data internally. Also, I think we could make wxString (and also wxStringView) able to copy from string_view.

Does this seem feasible?
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxString support for string_view?

Post by doublemax »

The mailing list / Google group is probably a better place to discuss this:
https://groups.google.com/forum/?hl=en& ... m/wx-users
Use the source, Luke!
ollydbg23
Super wx Problem Solver
Super wx Problem Solver
Posts: 438
Joined: Fri Dec 12, 2008 10:31 am

Re: wxString support for string_view?

Post by ollydbg23 »

I can't find any discussion about string_view in the maillist.
Indeed, I have the same question, so maybe I need to ask on in the maillist?
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxString support for string_view?

Post by doublemax »

I have the same question, so maybe I need to ask on in the maillist?
Yes, please.
Use the source, Luke!
ollydbg23
Super wx Problem Solver
Super wx Problem Solver
Posts: 438
Joined: Fri Dec 12, 2008 10:31 am

Re: wxString support for string_view?

Post by ollydbg23 »

Post Reply