anyway to set a const object after the fact?

2018-10-29 Thread aliak via Digitalmars-d-learn
Hi, so if you have this piece of code: struct C { void f() { string[] others; const string[] restArgs; foreach (i, arg; args) { if (isValidArg(arg)) { restArgs = args[i + 1 .. $]; break; } others ~= arg; } // "others" is a list of args

Re: anyway to set a const object after the fact?

2018-10-29 Thread Paul Backus via Digitalmars-d-learn
On Monday, 29 October 2018 at 21:50:32 UTC, aliak wrote: Hi, so if you have this piece of code: struct C { void f() { string[] others; const string[] restArgs; foreach (i, arg; args) { if (isValidArg(arg)) { restArgs = args[i + 1 .. $]; break; }

Re: anyway to set a const object after the fact?

2018-10-29 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Oct 29, 2018 at 09:50:32PM +, aliak via Digitalmars-d-learn wrote: > Hi, so if you have this piece of code: > > struct C { > > void f() { > string[] others; > const string[] restArgs; > foreach (i, arg; args) { > if (isValidArg(arg)) { > restArgs = args[i

Profiling with DUB?

2018-10-29 Thread Dukc via Digitalmars-d-learn
I'm trying to profile my program, built like: dub build --build=profile When I run the program, where is the performance profile file supposed to appear? I can find nothing new in the program/project root directory. This happens regardless whether I compile with dmd or ldc2.

Small or big dub packages

2018-10-29 Thread Igor via Digitalmars-d-learn
Can someone tell me what are pros and cons of having multiple extra small dub packages that depend on each other versus one dub package that has a bunch of functionality? Good example for this is dlib (https://github.com/gecko0307/dlib). It has many functionalities that could be split into

Re: Where do I learn to use GtkD

2018-10-29 Thread helxi via Digitalmars-d-learn
On Sunday, 13 March 2016 at 19:28:57 UTC, karabuta wrote: Gtk3 from python3 has got I nice book with examples that are not so advanced but enough to get you doing real work(from a beginner point of view). GtkD seem to have changed the API structure compared to python3 Gtk3 and the demo

Re: Small or big dub packages

2018-10-29 Thread Laurent Tréguier via Digitalmars-d-learn
On Monday, 29 October 2018 at 11:31:55 UTC, Igor wrote: Can someone tell me what are pros and cons of having multiple extra small dub packages that depend on each other versus one dub package that has a bunch of functionality? Good example for this is dlib (https://github.com/gecko0307/dlib).

Re: struggling to link against a C global in D (win/vs2017)

2018-10-29 Thread 12345swordy via Digitalmars-d-learn
On Monday, 29 October 2018 at 00:16:38 UTC, Stanislav Blinov wrote: On Monday, 29 October 2018 at 00:01:21 UTC, DanielG wrote: In my D app I'm declaring it this way: extern (C) { extern __gshared int myIntValue; int myIntFunc (int a, int b); } The function seems to link OK,