Re: line terminators

2022-09-28 Thread NonNull via Digitalmars-d-learn
On Wednesday, 28 September 2022 at 21:17:16 UTC, rassoc wrote: On 9/28/22 21:36, NonNull via Digitalmars-d-learn wrote: [...] If you have structured data, you can use byRecord [1] to read the important parts right into a tuple. [...] Thanks --- very helpful.

Re: line terminators

2022-09-28 Thread rassoc via Digitalmars-d-learn
On 9/28/22 21:36, NonNull via Digitalmars-d-learn wrote: If I want to read a text file line by line, treating any one of these things as a newline, there would seem to be no canned way to do that in std.stdio . 1.) What is the best way to achieve this result in D? If you have structured

Re: Interfacing with basic C++ class

2022-09-28 Thread Ali Çehreli via Digitalmars-d-learn
On 9/28/22 12:57, Riccardo M wrote: > class MyClass { > public: > int field; > MyClass(int a) : field(a) {} Make the following function 'virtual': > int add(int asd) { virtual int add(int asd) { I think the C++ class does not get a vptr without a virtual function and

Interfacing with basic C++ class

2022-09-28 Thread Riccardo M via Digitalmars-d-learn
I think I am stuck in the easiest of the issues and yet it seems I cannot get around this. I have a C++ file: ``` class MyClass { public: int field; MyClass(int a) : field(a) {} int add(int asd) { return asd + 1; } }; MyClass* instantiate(int asd) { return new

line terminators

2022-09-28 Thread NonNull via Digitalmars-d-learn
Hello, I notice that readln from std.stdio has '\n' as the default line terminator. What about multiple line terminators in UTF-8 being used in one input file, such as '\n', NEL, LS, PS? And in Windows "\r\n" is a line terminator, and what if NEL, LS, PS exist in a Windows UTF-8 text file as

Re: Template function alias that leaves out the last type parameter

2022-09-28 Thread rassoc via Digitalmars-d-learn
On 9/28/22 18:47, torhu via Digitalmars-d-learn wrote: It works like writefln, so that example would not compile. I forgot to make the format string explicit, I probably should have done that. ``` private template _messageBox(string title, int style) { void _messageBox(T...)(T args)

Re: Template function alias that leaves out the last type parameter

2022-09-28 Thread torhu via Digitalmars-d-learn
On Wednesday, 28 September 2022 at 12:43:52 UTC, rassoc wrote: On 9/28/22 02:04, torhu via Digitalmars-d-learn wrote: Thank you, works like a charm! It does? How are you formatting `info("foo", 'a', 42)` inside the template if I may ask? It works like writefln, so that example would not

Re: Template function alias that leaves out the last type parameter

2022-09-28 Thread rassoc via Digitalmars-d-learn
On 9/28/22 02:04, torhu via Digitalmars-d-learn wrote: Thank you, works like a charm! It does? How are you formatting `info("foo", 'a', 42)` inside the template if I may ask?

Re: importC and cmake

2022-09-28 Thread zjh via Digitalmars-d-learn
On Wednesday, 28 September 2022 at 05:29:41 UTC, Chris Piker wrote: `Xmake` is indeed simpler. `Xmake` is really nice!