Re: C++ std::string_view equivalent in D?

2018-02-21 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 10:43:14 UTC, 0x wrote: Gotta save this too. [BTW how do I post a thumbs up emoji] 

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 10:43 AM, 0x wrote: On Wednesday, 21 February 2018 at 10:24:39 UTC, ketmar wrote: 0x wrote: [...] and that is exactly what slices are for! ;-) you are probably better to use `const(char)[]`, tho. like this: // don't store `s`, as it's contents may change

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 10:24:39 UTC, ketmar wrote: 0x wrote: [...] and that is exactly what slices are for! ;-) you are probably better to use `const(char)[]`, tho. like this: // don't store `s`, as it's contents may change after exiting of `myfunc` // (this

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 10:41 AM, 0x wrote: On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero)

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 10:22:56 UTC, rikki cattermole wrote: On 21/02/2018 10:17 AM, 0x wrote: On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 10:23:23 UTC, Jonathan M Davis wrote: As I said in my previous response, read this article: https://dlang.org/articles/d-array-article.html Sorry, I didn't see this before I replied. Had I, I wouldn't have done that. string sv = "some string"; then _zero_

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread ketmar via Digitalmars-d-learn
0x wrote: On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 10:17 AM, 0x wrote: On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero)

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, February 21, 2018 10:17:55 0x via Digitalmars-d-learn wrote: > On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: > > What is the equivalent of C++17 std::string_view (an object > > that can refer to a constant contiguous sequence of char-like > > objects with

C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, February 21, 2018 09:21:58 0x via Digitalmars-d-learn wrote: > What is the equivalent of C++17 std::string_view (an object that > can refer to a constant contiguous sequence of char-like objects > with the first element of the sequence at position zero) in D? > > PS: I'm

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread Smaehtin via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 9:21 AM, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after years (since DMD 1 days). A

C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after years (since DMD 1 days). A lot changes since v1.0.