Re: how to access struct member using [] operator?

2016-09-24 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 25 September 2016 at 04:54:31 UTC, grampus wrote: Dear all For example, I have a struct struct point{int x;int y} point a; Is there an easy way to access x and y by using a["x"] and a["y"] I guess I need to overload [], but can't figure out how. Someone can help? Thank you very m

how to access struct member using [] operator?

2016-09-24 Thread grampus via Digitalmars-d-learn
Dear all For example, I have a struct struct point{int x;int y} point a; Is there an easy way to access x and y by using a["x"] and a["y"] I guess I need to overload [], but can't figure out how. Someone can help? Thank you very much

Re: May be a simple dub answer if my question even makes sense?

2016-09-24 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 24 September 2016 at 16:51:47 UTC, WhatMeWorry wrote: My app.d has: module app; import common.derelict_libraries; and derelict_libraries.d has: module derelict_libraries; import derelict.glfw3.glfw3; import derelict.opengl3.gl3; It's fine to import other imports, Right? As l

Re: std.net.curl and libcurl.so

2016-09-24 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Saturday, 24 September 2016 at 19:42:11 UTC, Joseph Rushton Wakeling wrote: On Saturday, 24 September 2016 at 19:27:31 UTC, Joseph Rushton Wakeling wrote: Further to earlier remarks: I now think this may be a general problem of LDC 1.0.0 and not a problem of the snap package. I tried buildi

Re: std.net.curl and libcurl.so

2016-09-24 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Saturday, 24 September 2016 at 19:27:31 UTC, Joseph Rushton Wakeling wrote: Further to earlier remarks: I now think this may be a general problem of LDC 1.0.0 and not a problem of the snap package. I tried building my simple curl-using program using an LDC 1.0.0 build and installed from sou

Re: std.net.curl and libcurl.so

2016-09-24 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Saturday, 24 September 2016 at 19:11:52 UTC, Joseph Rushton Wakeling wrote: On Friday, 23 September 2016 at 00:55:43 UTC, Stefan Koch wrote: This suggests that libcurl is loaded. could you compile with -g ? and then post the output ? Further to earlier remarks: I now think this may be a gen

Re: std.net.curl and libcurl.so

2016-09-24 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Friday, 23 September 2016 at 00:55:43 UTC, Stefan Koch wrote: This suggests that libcurl is loaded. could you compile with -g ? and then post the output ? Thanks Stefan! It was compiled with -g, but I was missing the libcurl3-dbg package. Here's the results: #0 0x0046b048 in gc

Re: May be a simple dub answer if my question even makes sense?

2016-09-24 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 24 September 2016 at 06:05:11 UTC, Mike Parker wrote: On Saturday, 24 September 2016 at 02:33:22 UTC, WhatMeWorry wrote: I see that dub has all the .d import files already placed in C:\Users\Me\AppData\Roaming\dub\packages\derelict-gl3-1.0.19\derelict-gl3\source\derelict\opengl3

Re: Lazily evaluated property pointing to read only object

2016-09-24 Thread Basile B. via Digitalmars-d-learn
On Saturday, 24 September 2016 at 10:59:50 UTC, mikey wrote: On Saturday, 24 September 2016 at 10:16:34 UTC, Basile B. wrote: You don't need to cast, from "mutable" to "const" is implicit: https://dlang.org/spec/const3.html#implicit_conversions Ok, but using const would be an accepted way of d

Re: Lazily evaluated property pointing to read only object

2016-09-24 Thread mikey via Digitalmars-d-learn
On Saturday, 24 September 2016 at 10:16:34 UTC, Basile B. wrote: You don't need to cast, from "mutable" to "const" is implicit: https://dlang.org/spec/const3.html#implicit_conversions Ok, but using const would be an accepted way of doing this? The options I could see were to have "_o" as a con

Re: Lazily evaluated property pointing to read only object

2016-09-24 Thread Basile B. via Digitalmars-d-learn
On Saturday, 24 September 2016 at 09:08:52 UTC, mikey wrote: I'm trying to figure out how to best write a class with a property that is only evaluated when it's called for the first time. And that returns an object which shouldn't be modifiable a part of the owning class. I've had a go at doi

Assignment Semantics Trait

2016-09-24 Thread Nordlöw via Digitalmars-d-learn
Is there a trait, say `assignmentSemantics`, that tells whether a container type `C` has - copy (C++ containers), - reference (D containers), or - move (Rust) semantics when an instance of `C` is assigned to a new variable. If not, could `__traits(hasMember, C, "dup")` play a role in such a

Lazily evaluated property pointing to read only object

2016-09-24 Thread mikey via Digitalmars-d-learn
I'm trying to figure out how to best write a class with a property that is only evaluated when it's called for the first time. And that returns an object which shouldn't be modifiable a part of the owning class. I've had a go at doing something like this but am not very sure if this is how to