Re: Strings and Slices

2021-02-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/20/21 2:31 PM, Mike Brown wrote: On Saturday, 20 February 2021 at 19:28:00 UTC, Mike Brown wrote: On Thursday, 18 February 2021 at 21:08:45 UTC, Adam D. Ruppe wrote: [...] Thank you. Is there a standardised type to make "mark"? size_t or is a normal integer suitable? Ah, and whats the

Re: Strings and Slices

2021-02-20 Thread Mike Brown via Digitalmars-d-learn
On Saturday, 20 February 2021 at 19:28:00 UTC, Mike Brown wrote: On Thursday, 18 February 2021 at 21:08:45 UTC, Adam D. Ruppe wrote: [...] Thank you. Is there a standardised type to make "mark"? size_t or is a normal integer suitable? Ah, and whats the recommended way to iterate over a slic

Re: Strings and Slices

2021-02-20 Thread Mike Brown via Digitalmars-d-learn
On Thursday, 18 February 2021 at 21:08:45 UTC, Adam D. Ruppe wrote: On Thursday, 18 February 2021 at 20:47:33 UTC, Mike Brown wrote: [...] My c++ is rusty af but yes I think so. A d slice is `struct slice { size_t length; T* ptr; }` so when in doubt just think back to what that does. [...

Re: Strings and Slices

2021-02-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 18 February 2021 at 20:47:33 UTC, Mike Brown wrote: Is slices comparable to a string_view? My c++ is rusty af but yes I think so. A d slice is `struct slice { size_t length; T* ptr; }` so when in doubt just think back to what that does. string lex_identifier(ref string input)