Re: auto vectorization notes

2020-03-27 Thread Crayo List via Digitalmars-d-learn
On Monday, 23 March 2020 at 18:52:16 UTC, Bruce Carneal wrote: When speeds are equivalent, or very close, I usually prefer auto vectorized code to explicit SIMD/__vector code as it's easier to read. (on the downside you have to guard against compiler code-gen performance regressions) One odd

Re: How to create an array with custom length?

2020-03-27 Thread Anonymouse via Digitalmars-d-learn
On Friday, 27 March 2020 at 19:30:39 UTC, Quantium wrote: Code int n=0; readf(" %d", &n); int[n] m; generated an error (DMD compiler): Cannot read n at compile time. How to create an array with custom length? The tour has a page for this: https://tour.dlang.org/tour/en/basics/array

How to create an array with custom length?

2020-03-27 Thread Quantium via Digitalmars-d-learn
Code int n=0; readf(" %d", &n); int[n] m; generated an error (DMD compiler): Cannot read n at compile time. How to create an array with custom length?

A question about C++ interop

2020-03-27 Thread YD via Digitalmars-d-learn
Hi, I have a C++ header file which looks like class A { public: static A *create(); virtual int f() const = 0; }; And there is a C++ library file which provides the implementation, so that if I write a C++ program and call auto *p = A::create(); std::cout <

Re: Blog post about multidimensional arrays in D

2020-03-27 Thread p.shkadzko via Digitalmars-d-learn
On Friday, 27 March 2020 at 13:10:00 UTC, jmh530 wrote: On Friday, 27 March 2020 at 10:57:10 UTC, p.shkadzko wrote: I decided to write a small blog post about multidimensional arrays in D on what I learnt so far. It should serve as a brief introduction to Mir slices and how to do basic manipul

Re: Blog post about multidimensional arrays in D

2020-03-27 Thread p.shkadzko via Digitalmars-d-learn
On Friday, 27 March 2020 at 11:19:06 UTC, WebFreak001 wrote: On Friday, 27 March 2020 at 10:57:10 UTC, p.shkadzko wrote: [...] I don't really know mir myself, but for the start of the content: [...] Ok, looks like I need to reread the slices topic. It always confused me especially when i

Re: Blog post about multidimensional arrays in D

2020-03-27 Thread jmh530 via Digitalmars-d-learn
On Friday, 27 March 2020 at 10:57:10 UTC, p.shkadzko wrote: I decided to write a small blog post about multidimensional arrays in D on what I learnt so far. It should serve as a brief introduction to Mir slices and how to do basic manipulations with them. It started with a small file with snipp

Re: Blog post about multidimensional arrays in D

2020-03-27 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 27 March 2020 at 10:57:10 UTC, p.shkadzko wrote: I decided to write a small blog post about multidimensional arrays in D on what I learnt so far. It should serve as a brief introduction to Mir slices and how to do basic manipulations with them. It started with a small file with snipp

Blog post about multidimensional arrays in D

2020-03-27 Thread p.shkadzko via Digitalmars-d-learn
I decided to write a small blog post about multidimensional arrays in D on what I learnt so far. It should serve as a brief introduction to Mir slices and how to do basic manipulations with them. It started with a small file with snippets for personal use but then kind of escalated into an idea

Re: How package Dlang in a standalone portable executable?

2020-03-27 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 26 March 2020 at 23:19:20 UTC, Marcone wrote: I need package Dlang in a standalone portable executable. I need packcages all dependencies, dlls, files, etc in one executable file. by default if you use dub it will statically link phobos and druntime into the executable, so you ha

Re: How to code Z-Function of string?

2020-03-27 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 26 March 2020 at 20:08:39 UTC, Dennis wrote: On Thursday, 26 March 2020 at 19:34:08 UTC, Quantium wrote: 1. How can I make string ONLY char[] (Not immutable) You can use .dup to make a mutable copy of an array. ``` char[] a = "abc".dup; ``` extending on this: if you want to wor