Re: Multitasking question: Making a picture viewer, loading lots of images in the background

2019-04-02 Thread DanielG via Digitalmars-d-learn
I'm no threading expert but 1000 - if those indeed are real threads (like, preemptive OS threads) - is wa too many. My understanding is that there's no benefit to creating more than the number of hyperthreads your CPU supports (minus your main thread?). So you'd want a work queue of all th

Multitasking question: Making a picture viewer, loading lots of images in the background

2019-04-02 Thread realhet via Digitalmars-d-learn
Hi, I'm writing a picture browser program and I'd like to ask for a bit of assistance. My app is basically a Win32 window with an OpenGL surface. Currently I'm able to display a lot of pictures in it. The decompression of the bitmaps take place at the beginning of the program. I want to m

Re: Access outer member of struct from inner struct

2019-04-02 Thread Q. Schroll via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 18:52:07 UTC, Jacob Carlborg wrote: On 2019-04-02 20:44, Q. Schroll wrote: After removing the calls to writeln, the error I get is: `this` for `read` needs to be type `Outer` not type `Inner` You cannot access stuff in Outer because Inner objects are not outer o

Re: Access outer member of struct from inner struct

2019-04-02 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-04-02 20:44, Q. Schroll wrote: After removing the calls to writeln, the error I get is: `this` for `read` needs to be type `Outer` not type `Inner` You cannot access stuff in Outer because Inner objects are not outer objects and don't implicitly own an Outer object. In your Inner me

Re: Get attributes of a field?

2019-04-02 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-04-02 15:23, Alex wrote: __traits(getAttributes, T) Requires a type and a field is unfortunately not a type ;/ enum attr; struct Foo { @attr int a; } void main() { alias a = __traits(getAttributes, Foo.a); } -- /Jacob Carlborg

Re: Get mangled name of field?

2019-04-02 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-04-02 15:11, Alex wrote: How do I get the mangled name of a field? mangledName!T requires passing a type ;/ struct Foo { int a; } void main() { writeln(Foo.a.mangleof); } -- /Jacob Carlborg

Re: Access outer member of struct from inner struct

2019-04-02 Thread Q. Schroll via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 18:20:09 UTC, Andrey wrote: Hello, In this example how can I access the members "read" and "q" of struct Outer from Inner struct? struct Outer { ulong q = 1; Inner inner; void read(ulong value) { q += value; } void run() {

Re: gtkDcoding Blog Post for 2019-03-29 - Grid

2019-04-02 Thread Mike Wey via Digitalmars-d-learn
On 02-04-2019 17:48, Ron Tarrant wrote: On Tuesday, 2 April 2019 at 14:13:09 UTC, number wrote: Can somebody explain why getRgba() (apparently inherited from ColorChooser) does take an out parameter instead of returning an Gdk.RGBA? My understanding is this: Returning an object (as opposed

Access outer member of struct from inner struct

2019-04-02 Thread Andrey via Digitalmars-d-learn
Hello, In this example how can I access the members "read" and "q" of struct Outer from Inner struct? struct Outer { ulong q = 1; Inner inner; void read(ulong value) { q += value; } void run() { q.writeln; read(5); } struct Inner

Re: gtkDcoding Blog Post for 2019-03-29 - Grid

2019-04-02 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 14:13:09 UTC, number wrote: Thank you! You're welcome. :) The function ignores its argument and always uses member variable button2 instead. Changing the parameter type to MyRadioButton and using 'button' instead of 'button2' in the body works, so you could pass

Re: Get attributes of a field?

2019-04-02 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 13:36:47 UTC, Alex wrote: On Tuesday, 2 April 2019 at 13:23:37 UTC, Alex wrote: __traits(getAttributes, T) Requires a type and a field is unfortunately not a type ;/ I'd like to be able to get the attributes without having to instantiate the base type because that

Re: gtkDcoding Blog Post for 2019-03-29 - Grid

2019-04-02 Thread number via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 11:31:39 UTC, Ron Tarrant wrote: Today's the day for (yet) another blog post over on gtkDcoding.com and the subjects are: - the RadioButton, and - the ColorButton. You can find it here: http://gtkdcoding.com/2019/04/02/0023-radio-and-color-buttons.html Thank you

Re: Get attributes of a field?

2019-04-02 Thread Alex via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 13:23:37 UTC, Alex wrote: __traits(getAttributes, T) Requires a type and a field is unfortunately not a type ;/ I'd like to be able to get the attributes without having to instantiate the base type because that is problematic and I see no reason why it has to be i

Get attributes of a field?

2019-04-02 Thread Alex via Digitalmars-d-learn
__traits(getAttributes, T) Requires a type and a field is unfortunately not a type ;/

Get mangled name of field?

2019-04-02 Thread Alex via Digitalmars-d-learn
How do I get the mangled name of a field? mangledName!T requires passing a type ;/

Re: Forbidding implicit conversions from an enum type to an integer

2019-04-02 Thread Dennis via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 09:37:26 UTC, Per Nordlöw wrote: Are there any plans on deprecating implicit conversions of enums to integers? Not that I know of. Given the precedence of this: https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1015.md I doubt enum/integer-types are going to

Re: gtkDcoding Blog Post for 2019-03-29 - Grid

2019-04-02 Thread Ron Tarrant via Digitalmars-d-learn
Today's the day for (yet) another blog post over on gtkDcoding.com and the subjects are: - the RadioButton, and - the ColorButton. You can find it here: http://gtkdcoding.com/2019/04/02/0023-radio-and-color-buttons.html

Re: Forbidding implicit conversions from an enum type to an integer

2019-04-02 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 09:02:03 UTC, Dennis wrote: You can make the enum type not an integer type. ``` struct Int{int i;} enum E: Int { first = Int(0), second = Int(1), } ``` Thanks. Are there any plans on deprecating implicit conversions of enums to integers?

Re: Pass template parameter into q{} string

2019-04-02 Thread Marco de Wild via Digitalmars-d-learn
On Monday, 1 April 2019 at 17:32:29 UTC, Andrey wrote: Hello, enum Key : string { First = "qwerty", Last = "zaqy" } void main() { enum decl(alias values1) = q{ static foreach(value; values1) mixin("bool " ~ value ~ " = false;"); }; enum qqq =

Re: Forbidding implicit conversions from an enum type to an integer

2019-04-02 Thread Dennis via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 08:38:28 UTC, Per Nordlöw wrote: Is there a way (compiler flag) to forbid implicit conversions from an enum type to integer types? You can make the enum type not an integer type. ``` struct Int{int i;} enum E: Int { first = Int(0), second = Int(1), } ```

Forbidding implicit conversions from an enum type to an integer

2019-04-02 Thread Per Nordlöw via Digitalmars-d-learn
Is there a way (compiler flag) to forbid implicit conversions from an enum type to integer types?

Re: Build an alias array

2019-04-02 Thread Alex via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 07:47:29 UTC, Stefan Koch wrote: On Tuesday, 2 April 2019 at 03:15:36 UTC, Alex wrote: Is there any way to build an alias array at compile time that isn't too heavy in resources? {...} Hi Alex, I agree that there should be a way to do that. As soon as newCTFE is

Re: Build an alias array

2019-04-02 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 03:15:36 UTC, Alex wrote: Is there any way to build an alias array at compile time that isn't too heavy in resources? {...} Hi Alex, I agree that there should be a way to do that. As soon as newCTFE is a releasable state, I'll work on that again :) I'd be inter