Re: DScanner warns class is undocumented, how to resolve it ?

2020-05-13 Thread Vinod K Chandran via Digitalmars-d-learn
On Thursday, 14 May 2020 at 06:05:00 UTC, Vinod K Chandran wrote: Hi all, I wrote a class and in VS Code, DScanner says that the class is undocumented. How can i document a class ? Never mind, i found the answer myself. Just like in dot net, i added triple forward slash comment and problem so

DScanner warns class is undocumented, how to resolve it ?

2020-05-13 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I wrote a class and in VS Code, DScanner says that the class is undocumented. How can i document a class ?

Re: How to import modules from another folder ?

2020-05-13 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 13 May 2020 at 22:10:02 UTC, Vinod K Chandran wrote: Hi all, I am practicing some win32 api coding in D. So far so good. But when i tried to import some d files from another folder, i wonder how do this. This is my folder structure. --> Source Folder --> app.d //This is

How to import modules from another folder ?

2020-05-13 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am practicing some win32 api coding in D. So far so good. But when i tried to import some d files from another folder, i wonder how do this. This is my folder structure. --> Source Folder --> app.d //This is my main file. I am importing guiLib in this main file. -->

Re: Compilation error

2020-05-13 Thread chrissutton via Digitalmars-d-learn
On Wednesday, 7 October 2015 at 12:24:49 UTC, Loic wrote: On Wednesday, 7 October 2015 at 12:08:08 UTC, Loic wrote: On Tuesday, 15 September 2015 at 15:25:27 UTC, Loic wrote: On Tuesday, 15 September 2015 at 12:37:46 UTC, Adam D. Ruppe wrote: [...] Hello Adam, I installed with the exe insta

Re: How should I move in a DList ?

2020-05-13 Thread Gabriel via Digitalmars-d-learn
On Wednesday, 13 May 2020 at 14:29:53 UTC, Steven Schveighoffer wrote: I would never recommend either DList or SList for actual linked lists (for stacks or queues, they are OK), as they are very unweildy and don't do what most people want linked lists to do. -Steve [1] https://github.com/schv

[GTK-D] dub run leads to lld-link: error: could not open libcmt.lib: no such file or directory

2020-05-13 Thread BoQsc via Digitalmars-d-learn
A simple example I tried to run. #!/usr/bin/env dub /+ dub.sdl: name "hello" dependency "gtk-d" version="~>3.9.0" +/ import gtk.MainWindow; import gtk.Label; import gtk.Main; void main(string[] args) { Main.init(args); MainWindow win = new MainWindow("Hello World");

Re: Error running concurrent process and storing results in array

2020-05-13 Thread wjoe via Digitalmars-d-learn
On Friday, 8 May 2020 at 13:43:40 UTC, data pulverizer wrote: [...] I also chose kernel matrix calculations, you can't always call a library, sometimes you just need to write performant code. Aren't kernel function calls suffering a context switch though ?

Re: How should I move in a DList ?

2020-05-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/13/20 5:57 AM, Gabriel wrote: Hello, As I am totally new to D (my background is mainly C++) I am having trouble porting an algorithm that simplifies a polyline in 2D, very similar to this one: http://psimpl.sourceforge.net/reumann-witkam.html Here is what I would like: 1) Use a doubly-l

Re: Sum string lengths

2020-05-13 Thread MoonlightSentinel via Digitalmars-d-learn
On Wednesday, 13 May 2020 at 13:52:13 UTC, Andrey wrote: Hi, I want to sum lengths of all strings in array: auto data = ["qwerty", "az", ""]; Fold and reduce doesn't work: auto result = data.fold!`a + b.length`(0U); gives error: static assert: "Incompatible function/seed/element: bina

Re: Sum string lengths

2020-05-13 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, May 13, 2020 at 01:52:13PM +, Andrey via Digitalmars-d-learn wrote: > Hi, > I want to sum lengths of all strings in array: > > auto data = ["qwerty", "az", ""]; data.map!(s => s.length).sum; T -- It only takes one twig to burn down a forest.

Sum string lengths

2020-05-13 Thread Andrey via Digitalmars-d-learn
Hi, I want to sum lengths of all strings in array: auto data = ["qwerty", "az", ""]; Fold and reduce doesn't work: auto result = data.fold!`a + b.length`(0U); gives error: static assert: "Incompatible function/seed/element: binaryFun/uint/string" How to do it in one line?

Re: How to port C++ std::is_reference to D ?

2020-05-13 Thread wjoe via Digitalmars-d-learn
On Monday, 11 May 2020 at 19:08:09 UTC, Q. Schroll wrote: [...] 1. You can have variables ("data members") of reference type in structs. (They work like head-const pointers; if D had head-const or at least head-const pointers, those would be practically the same, only that references cannot b

Re: declaration of inner function is already defined

2020-05-13 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 13 May 2020 at 13:18:58 UTC, Andrey wrote: On Wednesday, 13 May 2020 at 12:58:11 UTC, Adam D. Ruppe wrote: On Wednesday, 13 May 2020 at 12:45:06 UTC, Andrey wrote: Why this works: It's just defined that way. Local functions follow local variable rules - must be declared before

Re: declaration of inner function is already defined

2020-05-13 Thread Andrey via Digitalmars-d-learn
On Wednesday, 13 May 2020 at 12:58:11 UTC, Adam D. Ruppe wrote: On Wednesday, 13 May 2020 at 12:45:06 UTC, Andrey wrote: Why this works: It's just defined that way. Local functions follow local variable rules - must be declared before use and names not allowed to overload each other. There

Re: declaration of inner function is already defined

2020-05-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 13 May 2020 at 12:45:06 UTC, Andrey wrote: Why this works: It's just defined that way. Local functions follow local variable rules - must be declared before use and names not allowed to overload each other. There might be a deeper reason too but like that's the main thing, th

declaration of inner function is already defined

2020-05-13 Thread Andrey via Digitalmars-d-learn
Hi, Why this works: void setBases(string type)(ref int data, string base, string[] syllables) { } void setBases(string type, T)(ref int data, const ref T source) { } void main() { int q = 6; setBases!"tt"(q, "qwerty", ["tg", "jj"]); setBases!"tt"(q, q); } and this doesn't work

Handle FormatSpec!char in the virtual toString() method of a class.

2020-05-13 Thread realhet via Digitalmars-d-learn
Hello, Is there a way to the following thing in a class instead of a struct? -- static struct Point { int x, y; void toString(W)(ref W writer, scope const ref FormatSpec!char f) if (isOutputRange!(W, char)) { // std.range.primitive

How should I move in a DList ?

2020-05-13 Thread Gabriel via Digitalmars-d-learn
Hello, As I am totally new to D (my background is mainly C++) I am having trouble porting an algorithm that simplifies a polyline in 2D, very similar to this one: http://psimpl.sourceforge.net/reumann-witkam.html Here is what I would like: 1) Use a doubly-linked list, preferably one from a s

Re: Get unknown symbol (struct, method, class) tagged with User Defined Attributes

2020-05-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-05-12 06:02, Steven Schveighoffer wrote: If you want a list of ALL symbols that have the UDA in the application, that would require some form of runtime reflection (like Java). D has very limited support for runtime reflection. In D, you would use some form of registration to tell the