Re: Why does multidimensional arrays not allocate properly?

2017-01-22 Thread Jot via Digitalmars-d-learn
On Sunday, 22 January 2017 at 08:07:26 UTC, rikki cattermole wrote: On 22/01/2017 9:05 PM, Jot wrote: auto x = new int[][](n,m); But one cannot freely assign anywhere in x: x[3,6] = 4 crashes. I, can, of course, convert everything to a linear matrix and index by i+w*j, but what's the point

Why does multidimensional arrays not allocate properly?

2017-01-22 Thread Jot via Digitalmars-d-learn
auto x = new int[][](n,m); But one cannot freely assign anywhere in x: x[3,6] = 4 crashes. I, can, of course, convert everything to a linear matrix and index by i+w*j, but what's the point of having multidimensional matrices in D if they don't allocate them fully?

Re: With not working with BitFlags

2017-01-20 Thread Jot via Digitalmars-d-learn
On Friday, 20 January 2017 at 09:12:04 UTC, Dukc wrote: This is fairly complex thing, but I managed to get it working: template EnumToFlags(E) if(is(E == enum)) { import std.traits, std.typecons, std.string; private static auto implementation() { string result;

with not working wtih BitFlags

2017-01-19 Thread Jot via Digitalmars-d-learn
struct EnumToFlags(alias E) { template opDispatch(string Name) { enum opDispatch = 1 << __traits(getMember, E, Name); }; }; enum X { a,b,c } auto q = EnumtoFlags!X; auto m = q.a; with(q) { auto m = a; } a undefined. Any way to get it to work? Maybe a

Re: cannot alias array ;/

2017-01-19 Thread Jot via Digitalmars-d-learn
On Thursday, 19 January 2017 at 12:50:06 UTC, John Colvin wrote: On Thursday, 19 January 2017 at 07:48:03 UTC, Jot wrote: alias a = myarray[k]; fails myarray is a multidimensial array that I want to reduce writing it every time but D complains that it can't alias it. I simply want it to do

cannot alias array ;/

2017-01-18 Thread Jot via Digitalmars-d-learn
alias a = myarray[k]; fails myarray is a multidimensial array that I want to reduce writing it every time but D complains that it can't alias it. I simply want it to do a direct substitution, nothing fancy, just to reducing typing.

Re: Updated D then undefined symbols in vibed

2016-11-24 Thread Jot via Digitalmars-d-learn
On Thursday, 24 November 2016 at 20:18:16 UTC, Jot wrote: On Thursday, 24 November 2016 at 17:46:38 UTC, ag0aep6g wrote: On 11/24/2016 06:15 PM, Jot wrote: I think you are failing to realize the first axiom I presented. I only updated dmd2. This shouldn't change the object and library files.

Re: Updated D then undefined symbols in vibed

2016-11-24 Thread Jot via Digitalmars-d-learn
On Thursday, 24 November 2016 at 17:46:38 UTC, ag0aep6g wrote: On 11/24/2016 06:15 PM, Jot wrote: I think you are failing to realize the first axiom I presented. I only updated dmd2. This shouldn't change the object and library files. They should essentially compile to the same thing and it

Re: Updated D then undefined symbols in vibed

2016-11-24 Thread Jot via Digitalmars-d-learn
On Thursday, 24 November 2016 at 16:49:20 UTC, Rene Zwanenburg wrote: On Thursday, 24 November 2016 at 16:17:19 UTC, Jot wrote: Any more ideas? Obviously something isn't getting linked in in the VS project. This is definitely a stale object file problem. From that error message it appears to

Re: Updated D then undefined symbols in vibed

2016-11-24 Thread Jot via Digitalmars-d-learn
On Thursday, 24 November 2016 at 10:04:36 UTC, Rene Zwanenburg wrote: On Thursday, 24 November 2016 at 09:52:32 UTC, Jot wrote: Seems like someone decided to screw up a lot of people by removing a lot of stuff ;/ I guess I should learn my lesson about assuming a "stable" dmd release won't

Updated D then undefined symbols in vibed

2016-11-24 Thread Jot via Digitalmars-d-learn
Using vibe D. designed to update dmd to latest and then I now get the following errors: .dub\obj\debug\dev\source\app.obj(app) Error 42: Symbol Undefined _D3std6format12arrayPtrDiffFNaNbNiNexAvxAvZi .dub\obj\debug\dev\source\app.obj(app) Error 42: Symbol Undefined

Re: Vibe.d diet template reuse

2016-11-14 Thread Jot via Digitalmars-d-learn
On Monday, 14 November 2016 at 08:28:24 UTC, Sönke Ludwig wrote: Am 03.11.2016 um 06:31 schrieb Jot: [...] The example above should basically work - the included template is inserted into the outer context and can access any functions or variables declared there. Alternatively, you can also

Vibe.d diet template reuse

2016-11-02 Thread Jot via Digitalmars-d-learn
I would like to create some generic diet templates for different html functionality. Some code in the template will need to be setup/changed for it to function properly. How can I write code that allows for one to express generic statements in the template but access/modify them in another

MongoDB/DB <-> D

2016-10-27 Thread Jot via Digitalmars-d-learn
Using Vibe.D here; How can one work with the DB's abstractly without incurring duplicity. I'd like to be able to create one struct and use that, either in D or the DB. I'd prefer to create a struct in D and interact through that struct with the database abstracted away. struct Person {