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

2016-09-25 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 25 September 2016 at 00:52:26 UTC, Mike Parker wrote: On Saturday, 24 September 2016 at 16:51:47 UTC, WhatMeWorry wrote: [...] As long as they're public. Imports are private by default, meaning their symbols are only visible locally. Change it to: module derelict_libraries; pub

Re: ndslice and RC containers

2016-09-25 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Thursday, 22 September 2016 at 20:23:57 UTC, Nordlöw wrote: On Thursday, 22 September 2016 at 13:30:28 UTC, ZombineDev wrote: ndslice (i.e. Slice(size_t N, Range) ) is a generalization of D's built-in slices (i.e. T[]) to N dimensions. Just like them, ... Please note that the support for cre

Re: Proper way to work around `Invalid memory operation`?

2016-09-25 Thread ketmar via Digitalmars-d-learn
use rc scheme (a-la std.stdio.File is using), so dtor will be called deterministically, not by GC. here is the sample of that, which creates lockfile. you can use RC implementation like that for many other things. it is mostly as cheap as class: the main struct is only size_t aka pointer (like

Re: How to get a screenshot?

2016-09-25 Thread Konstantin Kutsevalov via Digitalmars-d-learn
This is example: ``` import std.stdio; import gtk.Main; import gtk.MainWindow; import gtk.VBox, gtk.Label, gtk.Button; import gdk.Gdk; import gdk.Window; import gdk.Pixbuf; private import stdlib = core.stdc.stdlib : exit; int main(string[] args) { Main.init(args); new ApMainWindo

Re: How to get a screenshot?

2016-09-25 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Thursday, 22 September 2016 at 16:09:23 UTC, Antonio Corbi wrote: Ok, took the time to translate it to D and created a github repo to clone. You can download and try it from: https://github.com/antoniocorbibellot/dsshot Hope It helps you. Antonio Hey! It really works! https://github.

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

2016-09-25 Thread ag0aep6g via Digitalmars-d-learn
On 09/25/2016 06:26 PM, Basile B. wrote: Can we get an explanation from a compiler guy ? It seems the the switch statement is already evaluated at compiled time... Lodovico has already answered this. It's just an ordinary `auto` return type function. The actual return type is the common type

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

2016-09-25 Thread Basile B. via Digitalmars-d-learn
On Sunday, 25 September 2016 at 16:26:11 UTC, Basile B. wrote: On Sunday, 25 September 2016 at 16:07:59 UTC, Basile B. wrote: On Sunday, 25 September 2016 at 09:01:44 UTC, Namespace wrote: On Sunday, 25 September 2016 at 04:54:31 UTC, grampus wrote: Dear all For example, I have a struct struc

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

2016-09-25 Thread Basile B. via Digitalmars-d-learn
On Sunday, 25 September 2016 at 16:07:59 UTC, Basile B. wrote: On Sunday, 25 September 2016 at 09:01:44 UTC, Namespace wrote: 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

How to debug (potential) GC bugs?

2016-09-25 Thread Matthias Klumpp via Digitalmars-d-learn
Hello! I am working together with others on the D-based appstream-generator[1] project, which is generating software metadata for "software centers" and other package-manager functionality on Linux distributions, and is used by default on Debian, Ubuntu and Arch Linux. For Ubuntu, some modif

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

2016-09-25 Thread Basile B. via Digitalmars-d-learn
On Sunday, 25 September 2016 at 09:01:44 UTC, Namespace wrote: 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 [

Proper way to work around `Invalid memory operation`?

2016-09-25 Thread Matthias Klumpp via Digitalmars-d-learn
Hello! I have a class similar to this one: ``` class Dummy { private: string tmpDir; public: this (string fname) { tmpDir = buildPath ("/tmp", fname.baseName); std.file.mkdirRecurse (tmpDir); } ~this () { close (); } void close ()

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

2016-09-25 Thread grampus via Digitalmars-d-learn
On Sunday, 25 September 2016 at 09:01:44 UTC, Namespace wrote: 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 [

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

2016-09-25 Thread grampus via Digitalmars-d-learn
On Sunday, 25 September 2016 at 10:44:38 UTC, pineapple wrote: 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 [

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

2016-09-25 Thread pineapple 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

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

2016-09-25 Thread Lodovico Giaretta via Digitalmars-d-learn
On Sunday, 25 September 2016 at 09:01:44 UTC, Namespace wrote: import std.stdio; struct Something { int x, y; float z; auto opIndex()(string member) { switch (member) { case "x": return this.x; case "y": return thi

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

2016-09-25 Thread Namespace 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

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

2016-09-25 Thread Basile B. 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