is it posible to compile individual module separately?

2021-02-15 Thread bokuno_D via Digitalmars-d-learn
i want to compile individual module that are required to compile the main module. i just start learning D yeserday, i tried to compile serve-D LSP tobe used with SublimeLSP. i run "dub build" on it. but OOM kill the compiler. - is there a way to reduce memory consumtion of the compiler? or maybe

Re: Fastest way to "ignore" elements from array without removal

2021-02-15 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Feb 16, 2021 at 04:20:06AM +, z via Digitalmars-d-learn wrote: > What would be the overall best manner(in ease of implementation and > speed) to arbitrarily remove an item in the middle of an array while > iterating through it? > So far i've thought about simply using D's standard [0...

Re: Fastest way to "ignore" elements from array without removal

2021-02-15 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 04:20:06 UTC, z wrote: What would be the overall best manner(in ease of implementation and speed) to arbitrarily remove an item in the middle of an array while iterating through it? http://phobos.dpldocs.info/std.algorithm.iteration.filter.html

Fastest way to "ignore" elements from array without removal

2021-02-15 Thread z via Digitalmars-d-learn
What would be the overall best manner(in ease of implementation and speed) to arbitrarily remove an item in the middle of an array while iterating through it? So far i've thought about simply using D's standard [0...x] ~ [x+1..$] with an array of indexes but wouldn't that just cause slow reallo

Re: how to make this function nothrow?

2021-02-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/15/21 4:04 PM, Jack wrote: I have to make my function nothrow because the function that calls it (not written by me) is nothrow. So I need to wrap my code in a try-catch() but how will I report the error message, if the toString() from Throwable isn't nothrow? how do I get out this circula

Re: how to make this function nothrow?

2021-02-15 Thread Ali Çehreli via Digitalmars-d-learn
On 2/15/21 1:04 PM, Jack wrote: > I have to make my function nothrow because the function that calls it > (not written by me) is nothrow. So I need to wrap my code in a > try-catch() but how will I report the error message, if the toString() > from Throwable isn't nothrow? how do I get out this c

Re: how to make this function nothrow?

2021-02-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 15 February 2021 at 21:04:50 UTC, Jack wrote: obviously, insert a try-catch() within catch() is a circular dependence and doesn't solve the problem either (even if it, I think it would be quite ugly) well that's prolly the way to do it, just catch Exception and like assert(0) if it

how to make this function nothrow?

2021-02-15 Thread Jack via Digitalmars-d-learn
I have to make my function nothrow because the function that calls it (not written by me) is nothrow. So I need to wrap my code in a try-catch() but how will I report the error message, if the toString() from Throwable isn't nothrow? how do I get out this circular dependence? void f() nothro

Re: Confusing with chunkBy

2021-02-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 15 February 2021 at 20:51:53 UTC, Maksim wrote: Thanks for answer, Adam. I lost the key word "adjacent". yeah, you aren't the only one, I think the docs should call it more more illustratively with an example or something too. The reason why it is designed this way is just to get

Re: Confusing with chunkBy

2021-02-15 Thread Maksim via Digitalmars-d-learn
On Monday, 15 February 2021 at 20:08:45 UTC, Adam D. Ruppe wrote: On Monday, 15 February 2021 at 19:57:39 UTC, Maksim wrote: Hello. Why The docs say it: "chunks an input range into subranges of equivalent adjacent elements." The key word there is "adjacent". Thanks for answer, Adam. I l

Re: Confusing with chunkBy

2021-02-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 15 February 2021 at 19:57:39 UTC, Maksim wrote: Hello. Why The docs say it: "chunks an input range into subranges of equivalent adjacent elements." The key word there is "adjacent". and the docs follow up "Elements in the subranges will always appear in the same order they appea

Confusing with chunkBy

2021-02-15 Thread Maksim via Digitalmars-d-learn
Hello. Why chunkBy!((a,b) => a[1] == b[1])( [ [1,1], [1,2], [2,2], [2,1] ]); returns a range with 3 subranges: [ [[1,1]], [[1,2], [2,2]], [[2,1]] ] I thought it would returns a range with 2 subranges [ [[1,1], [2,1]], [[1,2],[2,2]] ] It turns out that [1,1] and [2,1] are not grou

Re: Is there other way to do that?

2021-02-15 Thread mw via Digitalmars-d-learn
On Monday, 15 February 2021 at 07:26:56 UTC, Jack wrote: I need to check if an instance is of a specific type derived from my base class but this class has template parameter and this type isn't available at time I'm checking it. Something like: class B { } class A(T) : B { } class X : B { }

Re: Enum template for cpp binding

2021-02-15 Thread novice3 via Digitalmars-d-learn
On Monday, 15 February 2021 at 14:03:26 UTC, Paul Backus wrote: This will do most of it: Thank you Paul!

Re: Enum template for cpp binding

2021-02-15 Thread Paul Backus via Digitalmars-d-learn
On Monday, 15 February 2021 at 12:37:14 UTC, novice3 wrote: This is reduced example. I am sorry for this type of question, but could please anybody show me template for this boring coding? Is this possible to avoid this manual coding? Show me direction or examples please. This will do most of

Enum template for cpp binding

2021-02-15 Thread novice3 via Digitalmars-d-learn
Hello. I want make binding for some CPP api. I have .h file with enums like: /// typedef enum { SOMEAPI_PHASE_A = 91, SOMEAPI_PHASE_B = 92, SOMEAPI_PHASE_C = 93 } someapiPhase; /// It used later in .cpp like: func(SOMEAPI_PHASE_A); I want .d file like this: ///

Re: Is there other way to do that?

2021-02-15 Thread Rumbu via Digitalmars-d-learn
On Monday, 15 February 2021 at 07:26:56 UTC, Jack wrote: I need to check if an instance is of a specific type derived from my base class but this class has template parameter and this type isn't available at time I'm checking it. Something like: class B { } class A(T) : B { } class X : B { }

Re: Is there other way to do that?

2021-02-15 Thread evilrat via Digitalmars-d-learn
On Monday, 15 February 2021 at 07:26:56 UTC, Jack wrote: I need to check if an instance is of a specific type derived from my base class but this class has template parameter and this type isn't available at time I'm checking it. Something like: Non-templated interface/base class is probabl