Vibe.d form file attributes

2016-12-20 Thread aberba via Digitalmars-d-learn
In PHP, I am able to access the name attribute of multiple files submitted through forms at the server side in $_FILES global. For example, a file input with name="picture[]" will allow me to upload multiples files with the same attribute name. This can be access in PHP as; $files =

Re: meaning of "auto ref const"?

2016-12-20 Thread Ali Çehreli via Digitalmars-d-learn
As a general rule, 'auto ref' should probably be const. If the purpose of 'ref' is so that the argument would be mutated, then allowing a copy of an rvalue to this function could very well be a bug: struct S { int i; } void foo()(auto ref S s) { s.i = 42; // <-- Cannot be observed if

Re: Vibe.d form file attributes

2016-12-20 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 20 December 2016 at 18:22:51 UTC, aberba wrote: [...] Now I wanted to implement this in D (vibe.d) and here is what I did in the file upload handler. void upload(HTTPServerRequest req, HTTPServerResponse res) { import std.stdio; foreach(picture; req.files) // req.files

Re: meaning of "auto ref const"?

2016-12-20 Thread Picaud Vincent via Digitalmars-d-learn
On Tuesday, 20 December 2016 at 19:24:32 UTC, Ali Çehreli wrote: As a general rule, 'auto ref' should probably be const. If the purpose of 'ref' is so that the argument would be mutated, then allowing a copy of an rvalue to this function could very well be a bug: struct S { int i; }

Multidimensional array access

2016-12-20 Thread somebody via Digitalmars-d-learn
I though D should have syntax similarities with C, but recently I've found that array indexing in D is different. Suppose we have a code: import std.stdio; void main () { wstring[6][2] strings; strings[2][0] = "test"; } It fails to compile because of error: "./main.d(6): Error:

Re: Multidimensional array access

2016-12-20 Thread somebody via Digitalmars-d-learn
Thanks for the explanation

Re: Multidimensional array access

2016-12-20 Thread Ali Çehreli via Digitalmars-d-learn
On 12/20/2016 11:59 AM, somebody wrote: I though D should have syntax similarities with C, but recently I've found that array indexing in D is different. Suppose we have a code: import std.stdio; void main () { wstring[6][2] strings; strings[2][0] = "test"; } It fails to compile

Re: Vibe.d form file attributes

2016-12-20 Thread aberba via Digitalmars-d-learn
On Tuesday, 20 December 2016 at 18:42:11 UTC, WebFreak001 wrote: On Tuesday, 20 December 2016 at 18:22:51 UTC, aberba wrote: [...] iterate over req.files like this instead: foreach (name, picture; req.files) // name is "picture[]" now { ... } Nice. [...] pragma(msg,

Re: Multidimensional array access

2016-12-20 Thread Madaz Hill via Digitalmars-d-learn
On Tuesday, 20 December 2016 at 19:59:41 UTC, somebody wrote: I though D should have syntax similarities with C, but recently I've found that array indexing in D is different. Suppose we have a code: import std.stdio; void main () { wstring[6][2] strings; strings[2][0] = "test"; }

Re: meaning of "auto ref const"?

2016-12-20 Thread Ali Çehreli via Digitalmars-d-learn
On 12/18/2016 05:14 AM, Picaud Vincent wrote: > Another interrogation for me, who come from C++, is how to translate > into D: > > template void foo(T&& t); If it means "rvalue reference"[1], then there is no equivalent is D because D does not allow references to rvalues, even if const. If

Re: meaning of "auto ref const"?

2016-12-20 Thread Picaud Vincent via Digitalmars-d-learn
On Tuesday, 20 December 2016 at 20:08:32 UTC, Ali Çehreli wrote: If the purpose is optimization, the good news are Yes it is :) * Classes are already reference types so there is no lvalue or rvalue reference distinction there Ok, this one is quite intuitive. import std.stdio; ...

D3D12 memory issues

2016-12-20 Thread evilrat via Digitalmars-d-learn
Hello guys, I have DirectX 12 code that doesn't work in D (it works in C++), as the subject says this can be related to D heap and/or thread local storage. code can be found here (build with dmd -m32mscoff)

Re: Is it possbile to specify a remote git repo as dub dependency?

2016-12-20 Thread evilrat via Digitalmars-d-learn
On Tuesday, 20 December 2016 at 11:04:30 UTC, biocyberman wrote: On Monday, 19 December 2016 at 16:23:45 UTC, Guillaume Piolat wrote: What you can do for private package as of today is: - use path-based dependencies and put your packages in the same repo - use git submodules and

Re: BetterC classes

2016-12-20 Thread Kagamin via Digitalmars-d-learn
On Friday, 16 December 2016 at 18:29:33 UTC, Ilya Yaroshenko wrote: Undefined symbols for architecture x86_64: "__D14TypeInfo_Class6__vtblZ", referenced from: __D8cppclass2Hw7__ClassZ in cppclass-7ed89bd.o By using typeid you request the class' TypeInfo, and it pulls quite a lot.

Re: BetterC classes

2016-12-20 Thread kinke via Digitalmars-d-learn
On Tuesday, 20 December 2016 at 13:30:54 UTC, Kagamin wrote: On Friday, 16 December 2016 at 18:29:33 UTC, Ilya Yaroshenko wrote: Undefined symbols for architecture x86_64: "__D14TypeInfo_Class6__vtblZ", referenced from: __D8cppclass2Hw7__ClassZ in cppclass-7ed89bd.o By using typeid

Re: Is it possbile to specify a remote git repo as dub dependency?

2016-12-20 Thread biocyberman via Digitalmars-d-learn
On Monday, 19 December 2016 at 16:23:45 UTC, Guillaume Piolat wrote: What you can do for private package as of today is: - use path-based dependencies and put your packages in the same repo - use git submodules and path-based dub dependencies together If it's a public package, you can