Intelligent enums

2017-01-18 Thread Ignacious via Digitalmars-d-learn
I have the need to create an enum flag like structure to specify certain properties of a type easily. e.g., enum properties { Red, Blue, Hot, Sexy, Active, ... } But some properties will be mutually exclusive. I would like to contain all those rules for in the enum itself

Re: alias not valid with ~

2017-01-18 Thread Ignacious via Digitalmars-d-learn
On Thursday, 19 January 2017 at 02:51:03 UTC, rikki cattermole wrote: On 19/01/2017 3:35 PM, Ignacious wrote: On Thursday, 19 January 2017 at 02:25:44 UTC, Adam D. Ruppe wrote: On Thursday, 19 January 2017 at 02:15:04 UTC, rikki cattermole wrote: On 19/01/2017 3:08 PM, Ignacious wrote:

Re: alias not valid with ~

2017-01-18 Thread Ignacious via Digitalmars-d-learn
On Thursday, 19 January 2017 at 02:25:44 UTC, Adam D. Ruppe wrote: On Thursday, 19 January 2017 at 02:15:04 UTC, rikki cattermole wrote: On 19/01/2017 3:08 PM, Ignacious wrote: class Y { int y; alias y this; } class X { Y[] x; alias x this; } This should not fail: X x = new

alias not valid with ~

2017-01-18 Thread Ignacious via Digitalmars-d-learn
class Y { int y; alias y this; } class X { Y[] x; alias x this; } Yet X ~= 3; fails. 3 should be implicitly convertible to Y and then ~ should assign it. ?

writeln and ~

2017-01-14 Thread Ignacious via Digitalmars-d-learn
string concatenation is weird. We can do stuff like writeln(x); where x is, say a struct and it prints fine but when we do writeln(x ~ " ok"); it fails and requires us to convert x! Why can't string concatenation automatically try to convert the arguments? Is there any reason this is bad

Re: switch to member

2017-01-14 Thread Ignacious via Digitalmars-d-learn
On Saturday, 14 January 2017 at 11:32:10 UTC, Marc Schütz wrote: You can utilize a little-known `switch` syntax trick in combination with `foreach`. Because a `foreach` over tuples is unrolled at compile time, it works even if your fields don't have exactly the same types:

Re: switch to member

2017-01-14 Thread Ignacious via Digitalmars-d-learn
On Saturday, 14 January 2017 at 08:30:04 UTC, Meta wrote: On Saturday, 14 January 2017 at 05:29:49 UTC, Nicholas Wilson wrote: enum XX { X = Q.X.offsetof, Y = Q.Y.offsetof //ect. } and then *(cast(void*)(this) + x) = e; //if inside struct/class or *(cast(void*)(q) + x) = e; // if

switch to member

2017-01-13 Thread Ignacious via Digitalmars-d-learn
When doing common functionality for a switch, is there any way to optimize: switch(x) { case X: q.X = e; break; case Y: q.Y = e; break etc... } e is basically a value that, depending on the what kind(x), we assign it to a field in q. The name of

Re: Auto recursive function

2017-01-11 Thread Ignacious via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote: Hi, I am currently trying to create a function makeMultidimensionalArray which allocates memory for a multidimensional array. It is very similar with [1], the difference being that it is uninitialized. Here is the code: auto

Re: Android Status

2017-01-11 Thread Ignacious via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 03:49:42 UTC, Joakim wrote: On Tuesday, 10 January 2017 at 18:48:17 UTC, Ignacious wrote: [...] It's probably not easier, and in any case, android-x86 won't be supported, largely because I don't have any working x86 devices. [...] Ok, well the x86 thing

Re: Auto recursive function

2017-01-11 Thread Ignacious via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote: Hi, I am currently trying to create a function makeMultidimensionalArray which allocates memory for a multidimensional array. It is very similar with [1], the difference being that it is uninitialized. Here is the code: auto

Re: Android Status

2017-01-10 Thread Ignacious via Digitalmars-d-learn
Well, I posed a reply but I guess it didn't get though ;/ I'm only suing android-x86 because I thought it would be easier to test/debug. My device is a cortex-arm7. Two questions I have: 1. In the command lines present there is a lot of use of `x86`. I used them to compile the hello world

Re: Android Status

2017-01-09 Thread Ignacious via Digitalmars-d-learn
How difficult is it to build for x86/x64? Would be nice to be able to use something like http://www.android-x86.org/ as a test instead of an actual device. Does one simply have to use the proper ldc2/dmd and link in the correct libs? or is it more complex? Also, I'm a bit confused on how

Re: Android Status

2017-01-09 Thread Ignacious via Digitalmars-d-learn
On Monday, 9 January 2017 at 08:28:04 UTC, Joakim wrote: On Monday, 9 January 2017 at 00:40:35 UTC, Ignacious wrote: On Sunday, 8 January 2017 at 22:19:31 UTC, Joakim wrote: On Sunday, 8 January 2017 at 21:52:01 UTC, Ignacious wrote: Not sure what is going on, of course ;) So much BS just to

Re: Android Status

2017-01-08 Thread Ignacious via Digitalmars-d-learn
On Sunday, 8 January 2017 at 22:19:31 UTC, Joakim wrote: On Sunday, 8 January 2017 at 21:52:01 UTC, Ignacious wrote: Not sure what is going on, of course ;) So much BS just to do something that is suppose to be simple ;) test.d void main() { } here is test.o

Re: Android Status

2017-01-08 Thread Ignacious via Digitalmars-d-learn
On Sunday, 8 January 2017 at 20:34:21 UTC, Joakim wrote: On Sunday, 8 January 2017 at 19:58:06 UTC, Ignacious wrote: I suppose it will be easier to install a real ubuntu distro rather than relying on windows? All these issues seem to be related to outdated versions? Distributor ID: Ubuntu

Re: Android Status

2017-01-08 Thread Ignacious via Digitalmars-d-learn
Yeah, not a good idea to build from source yourself. Try the advice here, ie see if you can install a package with that library or just symlink to the older library if not: http://askubuntu.com/questions/771047/erlang-error-while-loading-shared-libraries-libncursesw-so-6 Well, the only

String characters not extended

2017-01-02 Thread Ignacious via Digitalmars-d-learn
when one prints out a string with some extended(I guess it's unicode), writeln prints out the ascii versions that do not correspond to what they really are. e.g., an umlaut is printed out as 1/2 or something. how to get it to print the correct codes?

Re: Android Status

2017-01-02 Thread Ignacious via Digitalmars-d-learn
On Monday, 2 January 2017 at 03:08:10 UTC, Joakim wrote: On Sunday, 1 January 2017 at 09:34:24 UTC, Ignacious wrote: Can you try sudo apt-get install libconfig9 I don't know if that will install something different, but it's the command I see others using online. Otherwise, check if the

Re: Android Status

2017-01-01 Thread Ignacious via Digitalmars-d-learn
Can you try sudo apt-get install libconfig9 I don't know if that will install something different, but it's the command I see others using online. Otherwise, check if the libconfig++9 package you installed included libconfig.so.9, which is what ldc is linked against. If not, install the

Re: Reducing visual clutter.

2016-12-31 Thread Ignacious via Digitalmars-d-learn
On Saturday, 31 December 2016 at 12:31:07 UTC, Nicholas Wilson wrote: On Saturday, 31 December 2016 at 11:39:39 UTC, Nicholas Wilson wrote: [...] Oh and `kernel` could be a template function that would need its args forwarded to it. Alias it away using a wrapper?

Re: Android Status

2016-12-31 Thread Ignacious via Digitalmars-d-learn
On Thursday, 29 December 2016 at 10:14:53 UTC, Joakim wrote: On Wednesday, 28 December 2016 at 23:33:57 UTC, Ignacious wrote: What is the current status for building android apps in D? I would like to create simple graphic based apps but don't wanna get bogged down in trying to get car moving

Re: Android Status

2016-12-30 Thread Ignacious via Digitalmars-d-learn
On Saturday, 31 December 2016 at 06:33:10 UTC, Ignacious wrote: On Saturday, 31 December 2016 at 05:52:00 UTC, Ignacious wrote: On Thursday, 29 December 2016 at 10:14:53 UTC, Joakim wrote: [...] Is there any way to get a package that works for windows? While the steps don't seem too

Re: Android Status

2016-12-30 Thread Ignacious via Digitalmars-d-learn
On Saturday, 31 December 2016 at 05:52:00 UTC, Ignacious wrote: On Thursday, 29 December 2016 at 10:14:53 UTC, Joakim wrote: [...] Is there any way to get a package that works for windows? While the steps don't seem too difficult to do, things never go well for me(something always breaks...

Re: Android Status

2016-12-30 Thread Ignacious via Digitalmars-d-learn
On Thursday, 29 December 2016 at 10:14:53 UTC, Joakim wrote: On Wednesday, 28 December 2016 at 23:33:57 UTC, Ignacious wrote: What is the current status for building android apps in D? I would like to create simple graphic based apps but don't wanna get bogged down in trying to get car moving

Re: Android Status

2016-12-29 Thread Ignacious via Digitalmars-d-learn
On Thursday, 29 December 2016 at 10:14:53 UTC, Joakim wrote: On Wednesday, 28 December 2016 at 23:33:57 UTC, Ignacious wrote: What is the current status for building android apps in D? I would like to create simple graphic based apps but don't wanna get bogged down in trying to get car moving

Android Status

2016-12-28 Thread Ignacious via Digitalmars-d-learn
What is the current status for building android apps in D? I would like to create simple graphic based apps but don't wanna get bogged down in trying to get car moving without any wheels.