Re: How to divide by space keeping words with spaces inside quotes?

2021-08-08 Thread jfondren via Digitalmars-d-learn
On Sunday, 8 August 2021 at 23:04:32 UTC, Marcone wrote: How to divide by space keeping words with spaces inside quotes? Exanple: string text = "Duck Cat \"Carl Rivers\" Dog"; I want split to: ["Duck", "Cat", "Carl Rivers", "Dog"] ATENTION: I DON'T WANT: ["Duck", "Cat", "Carl", "Rivers", "

Re: How to divide by space keeping words with spaces inside quotes?

2021-08-08 Thread Basile.B via Digitalmars-d-learn
On Monday, 9 August 2021 at 04:19:05 UTC, Basile.B wrote: On Sunday, 8 August 2021 at 23:04:32 UTC, Marcone wrote: How to divide by space keeping words with spaces inside quotes? Exanple: string text = "Duck Cat \"Carl Rivers\" Dog"; I want split to: ["Duck", "Cat", "Carl Rivers", "Dog"] A

Re: How to divide by space keeping words with spaces inside quotes?

2021-08-08 Thread Basile.B via Digitalmars-d-learn
On Sunday, 8 August 2021 at 23:04:32 UTC, Marcone wrote: How to divide by space keeping words with spaces inside quotes? Exanple: string text = "Duck Cat \"Carl Rivers\" Dog"; I want split to: ["Duck", "Cat", "Carl Rivers", "Dog"] ATENTION: I DON'T WANT: ["Duck", "Cat", "Carl", "Rivers", "

Re: input range with non copyable element

2021-08-08 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 8 August 2021 at 18:36:02 UTC, vit wrote: Hello, is there reason why elements of input range must be copyable? By design, not that I can think of. But it is assumed all over the place, unfortunately. You can make your `front` method return by `ref`, but you're still going to get bi

Re: How to divide by space keeping words with spaces inside quotes?

2021-08-08 Thread cy via Digitalmars-d-learn
On Sunday, 8 August 2021 at 23:04:32 UTC, Marcone wrote: How to divide by space keeping words with spaces inside quotes? Well the designers of ASCII were morons who decided that open quote and close quote would be the same damn letter, so it's a little trickier. Basically what you have to do

How to divide by space keeping words with spaces inside quotes?

2021-08-08 Thread Marcone via Digitalmars-d-learn
How to divide by space keeping words with spaces inside quotes? Exanple: string text = "Duck Cat \"Carl Rivers\" Dog"; I want split to: ["Duck", "Cat", "Carl Rivers", "Dog"] ATENTION: I DON'T WANT: ["Duck", "Cat", "Carl", "Rivers", "Dog"] How can I get it in Dlang?

input range with non copyable element

2021-08-08 Thread vit via Digitalmars-d-learn
Hello, is there reason why elements of input range must be copyable? For example this example works and copy ctor is never called: ```d import std.algorithm : map; import std.range; struct Foo{ int i; this(scope ref typeof(this) rhs)pure nothrow @safe @nogc{ //this.i = rhs

Re: How to profile compile times of a source code?

2021-08-08 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 30 January 2021 at 22:47:39 UTC, Ahmet Sait wrote: I'm looking for ways to figure out what parts of the code slows down the compiler other than brute force trial. You could try some of the tools listed on the wiki for build time profiling: https://wiki.dlang.org/Development_tool

Re: Build time

2021-08-08 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 23 July 2021 at 18:53:06 UTC, JG wrote: Any suggestion on how to try and improve the build time. You could try some of the tools listed on the wiki for build time profiling: https://wiki.dlang.org/Development_tools#Build_time_profiling (intentional bump to aid search results, as

Re: Tracy

2021-08-08 Thread Dennis via Digitalmars-d-learn
On Sunday, 8 August 2021 at 01:37:42 UTC, SealabJaster wrote: Could this be fixed? Or is this intentional? Of course it *could*, anyone can go to [the dlang wiki](https://wiki.dlang.org/LDC) and add a page for it. Johan Engelen is still working on [improving the feature](https://github.com/l

Re: Debugging linker errors

2021-08-08 Thread user1234 via Digitalmars-d-learn
On Sunday, 8 August 2021 at 11:58:42 UTC, Bogdan wrote: Hi, I tried to update my server from dmd v2.096.1 to v2.097 and I started getting this linker error: ``` Linking... /usr/bin/ld: .dub/build/executable-ssl11-debug-linux.posix-x86_64-dmd_v2.097.2-beta.1-7651E13F70724FF6B1F8D8B61B1AEABD/g

Re: using "invariant" with structs ... possible to call when a field value is set??

2021-08-08 Thread james.p.leblanc via Digitalmars-d-learn
On Sunday, 8 August 2021 at 11:36:51 UTC, FeepingCreature wrote: You can make a field set function like so: ``` struct S { private int x_; int x(int value) { return this.x_ = value; } int x() { return this.x_; } } ``` This will then run invariants. (boilerplate can automate that for yo

Debugging linker errors

2021-08-08 Thread Bogdan via Digitalmars-d-learn
Hi, I tried to update my server from dmd v2.096.1 to v2.097 and I started getting this linker error: ``` Linking... /usr/bin/ld: .dub/build/executable-ssl11-debug-linux.posix-x86_64-dmd_v2.097.2-beta.1-7651E13F70724FF6B1F8D8B61B1AEABD/gis-collective-api.o: in function `_D3std6traits__T6fqnSym

Re: using "invariant" with structs ... possible to call when a field value is set??

2021-08-08 Thread FeepingCreature via Digitalmars-d-learn
On Sunday, 8 August 2021 at 11:30:41 UTC, james.p.leblanc wrote: Hello, With structs, I understand that "invariant checking" is called (from dlang tour): It's called after the constructor has run and before the destructor is called. It's called before entering a member function

using "invariant" with structs ... possible to call when a field value is set??

2021-08-08 Thread james.p.leblanc via Digitalmars-d-learn
Hello, With structs, I understand that "invariant checking" is called (from dlang tour): It's called after the constructor has run and before the destructor is called. It's called before entering a member function invariant() is called after exiting a member function. But, is is

Re: Proper way to protect (lock) a struct field after initialization ??

2021-08-08 Thread james.p.leblanc via Digitalmars-d-learn
On Sunday, 8 August 2021 at 10:40:51 UTC, Ali Çehreli wrote: I understand your question differently from jfondren. You may be looking for a 'const' (or 'immutable') member: struct S { const int i; this(int i) { // This will work because "first assignment is initialization" thi

Re: Proper way to protect (lock) a struct field after initialization ??

2021-08-08 Thread Ali Çehreli via Digitalmars-d-learn
On 8/8/21 3:11 AM, james.p.leblanc wrote: Hello All. Is there a standard way to protect a field of a struct after the struct has been initialized? Is this possible with a struct? If not, I suppose a class (object) would be needed?  If so, are there any simple pointers to an example of this? T

Re: Proper way to protect (lock) a struct field after initialization ??

2021-08-08 Thread james.p.leblanc via Digitalmars-d-learn
On Sunday, 8 August 2021 at 10:19:46 UTC, jfondren wrote: On Sunday, 8 August 2021 at 10:11:37 UTC, james.p.leblanc wrote: Hello All. Is there a standard way to protect a field of a struct after the struct has been initialized? Is this possible with a struct? If not, I suppose a class (object

Re: Proper way to protect (lock) a struct field after initialization ??

2021-08-08 Thread jfondren via Digitalmars-d-learn
On Sunday, 8 August 2021 at 10:11:37 UTC, james.p.leblanc wrote: Hello All. Is there a standard way to protect a field of a struct after the struct has been initialized? Is this possible with a struct? If not, I suppose a class (object) would be needed? If so, are there any simple pointers to

Proper way to protect (lock) a struct field after initialization ??

2021-08-08 Thread james.p.leblanc via Digitalmars-d-learn
Hello All. Is there a standard way to protect a field of a struct after the struct has been initialized? Is this possible with a struct? If not, I suppose a class (object) would be needed? If so, are there any simple pointers to an example of this? Thanks in advance, James