Re: get only user-defined members

2017-12-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, December 16, 2017 04:01:10 Marc via Digitalmars-d-learn wrote: > how do I from class: > > class Person { > > > > string name; > > int age; > > > > } > > do: > > auto c = [__traits(allMembers, Person)]; > > then return only ["name", "age"] rather ["name, "age", "ctor", > "toString" ..

Re: Array Template

2017-12-15 Thread codephantom via Digitalmars-d-learn
On Friday, 15 December 2017 at 17:21:55 UTC, Vino wrote: Hi All, Request your help, Is it possible to an template array something similar as below so that we can insert any type of value(string, int etc). If possible can you provide me a example of how to define such array. Array!(Tuple!(

get only user-defined members

2017-12-15 Thread Marc via Digitalmars-d-learn
how do I from class: class Person { string name; int age; } do: auto c = [__traits(allMembers, Person)]; then return only ["name", "age"] rather ["name, "age", "ctor", "toString" ... ]?

Re: how do I read a class member's value using traits?

2017-12-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, December 16, 2017 03:34:43 Marc via Digitalmars-d-learn wrote: > I need to give a class C, read all user-defined members of it, > > both name and value dynamically. for example: > > class C { > > > > string a; > > string b; > > string c; > > > > } > > then > > > Class c = new C()

how do I read a class member's value using traits?

2017-12-15 Thread Marc via Digitalmars-d-learn
I need to give a class C, read all user-defined members of it, both name and value dynamically. for example: class C { string a; string b; string c; } then Class c = new C(); // set c members... enum string[] members = [__traits(allMembers, C)]; foreach(string member; members) {

Re: database or disk is full ; Error while posting message in this D forum

2017-12-15 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 15 December 2017 at 17:26:04 UTC, Vino wrote: Hi All, We are getting the above error message while posting any message in this forum, can any look into this please. Should be fixed now. Google was classifying one monitoring service's emails as spam, and completely rejecting anot

Re: Is there a pragma or command line option to ask DMD to show a warning when it implicitly casts from long to ulong ?

2017-12-15 Thread Ecstatic Coder via Digitalmars-d-learn
On Friday, 15 December 2017 at 21:55:12 UTC, Michael wrote: On Friday, 15 December 2017 at 21:29:10 UTC, Jonathan M Davis wrote: On Friday, December 15, 2017 20:40:10 Ecstatic Coder via Digitalmars-d-learn wrote: It's taken me some time to find an implicit cast bug ("if (my_sometimes_negative_i

Re: Tuple Array Sorting

2017-12-15 Thread Biotronic via Digitalmars-d-learn
On Friday, 15 December 2017 at 17:24:33 UTC, Vino wrote: Hi Biotronic, I was able to find a solution using container array and also date formatting, below is the code, please do let me know if you find any issue, as i have tested the script and it is working as expected. Program: import st

Re: weird exception on windows

2017-12-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/15/17 10:08 AM, Kagamin wrote: Maybe this https://issues.dlang.org/show_bug.cgi?id=18084 Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issue? https://github.com/dlang/phobos/pull/5932 -Steve

Re: Is there a pragma or command line option to ask DMD to show a warning when it implicitly casts from long to ulong ?

2017-12-15 Thread Michael via Digitalmars-d-learn
On Friday, 15 December 2017 at 21:29:10 UTC, Jonathan M Davis wrote: On Friday, December 15, 2017 20:40:10 Ecstatic Coder via Digitalmars-d-learn wrote: It's taken me some time to find an implicit cast bug ("if (my_sometimes_negative_index >= this_array.length)"), while a simple C++-like implic

Re: Is there a pragma or command line option to ask DMD to show a warning when it implicitly casts from long to ulong ?

2017-12-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, December 15, 2017 20:40:10 Ecstatic Coder via Digitalmars-d-learn wrote: > It's taken me some time to find an implicit cast bug ("if > (my_sometimes_negative_index >= this_array.length)"), while a > simple C++-like implicit-cast warning would have allowed me to > find this nasty bug WAY

Is there a pragma or command line option to ask DMD to show a warning when it implicitly casts from long to ulong ?

2017-12-15 Thread Ecstatic Coder via Digitalmars-d-learn
It's taken me some time to find an implicit cast bug ("if (my_sometimes_negative_index >= this_array.length)"), while a simple C++-like implicit-cast warning would have allowed me to find this nasty bug WAY sooner...

Re: Can't seemed to get parent name from a class at compile time.

2017-12-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 15 December 2017 at 17:16:41 UTC, 12345swordy wrote: Am I doing this right? I am expecting it to print "bob". parent gets the container of the symbol (in this case, the module), not the inheritance list. You probably want BaseClassesTuple!tom[0] instead, which is the class it inh

Re: Array Template

2017-12-15 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Dec 15, 2017 at 05:21:55PM +, Vino via Digitalmars-d-learn wrote: > Hi All, > > Request your help, Is it possible to an template array something > similar as below so that we can insert any type of value(string, int > etc). If possible can you provide me a example of how to define su

Re: overload

2017-12-15 Thread dark777 via Digitalmars-d-learn
On Friday, 15 December 2017 at 08:57:23 UTC, Biotronic wrote: On Thursday, 14 December 2017 at 22:47:15 UTC, dark777 wrote: I know that this community is not from c ++, but for some time I studied how to do overload of ostream operators in c ++ and I even managed to get to this result, I got to

database or disk is full ; Error while posting message in this D forum

2017-12-15 Thread Vino via Digitalmars-d-learn
Hi All, We are getting the above error message while posting any message in this forum, can any look into this please.

Re: Tuple Array Sorting

2017-12-15 Thread Vino via Digitalmars-d-learn
On Tuesday, 12 December 2017 at 19:00:01 UTC, Biotronic wrote: On Tuesday, 12 December 2017 at 15:19:35 UTC, Vino wrote: import std.algorithm: filter, map, sort; import std.container.array; import std.file: SpanMode, dirEntries, isDir ; import std.stdio: writefln; import std.typecons: Tuple, tup

Array Template

2017-12-15 Thread Vino via Digitalmars-d-learn
Hi All, Request your help, Is it possible to an template array something similar as below so that we can insert any type of value(string, int etc). If possible can you provide me a example of how to define such array. Array!(Tuple!(T n)) From, Vino.B

Can't seemed to get parent name from a class at compile time.

2017-12-15 Thread 12345swordy via Digitalmars-d-learn
import std.stdio; class bob { } class tom : bob { } void main() { writeln(__traits(identifier,__traits(parent,tom))); } Am I doing this right? I am expecting it to print "bob".

Re: Halp! type system (__expand_field_0 error), compile time/runtime questions (AoC-2017 puzzle spoilers inside)

2017-12-15 Thread aliak via Digitalmars-d-learn
On Friday, 15 December 2017 at 01:43:04 UTC, Steven Schveighoffer wrote: So the CTFE interpreter doesn't like something to do with your chain of ranges. This is not totally unexpected, as the CTFE engine has lots of quirks that make it sometimes puke on valid CTFE-able code. :( At this time,

Re: weird exception on windows

2017-12-15 Thread Kagamin via Digitalmars-d-learn
Maybe this https://issues.dlang.org/show_bug.cgi?id=18084

Re: weird exception on windows

2017-12-15 Thread Kagamin via Digitalmars-d-learn
That said, tempCString code is suspicious: https://github.com/dlang/phobos/blob/master/std/internal/cstring.d#L221 If unittest-versioned exists calls release-versioned tempCString, it will corrupt the stack. Try to replace 16 with 256 there and recompile your code.

Re: weird exception on windows

2017-12-15 Thread Kagamin via Digitalmars-d-learn
You said tests fail? class SourceResult { private const { string file; size_t line; } this(string fileName = __FILE__, size_t line = __LINE__, size_t range = 6) nothrow { this.file = fileName; this.

Re: TypeInfo_Class.interfaces has TypeInfo_Class and not TypeInfo_Interface?

2017-12-15 Thread Tofu Ninja via Digitalmars-d-learn
On Friday, 15 December 2017 at 05:19:04 UTC, Tofu Ninja wrote: TypeInfo_Class.interfaces has TypeInfo_Class and not TypeInfo_Interface? Is this correct? Or is it a bug? Doesn't make much sense to me. Also the following code prints false so there are some consequences to this. import std.std

Re: weird exception on windows

2017-12-15 Thread Kagamin via Digitalmars-d-learn
You can also try to call `exists` somewhere before this part of code.

Re: High-resolution thread sleep

2017-12-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/15/17 5:43 AM, Rene Zwanenburg wrote: On Friday, 15 December 2017 at 01:49:56 UTC, Steven Schveighoffer wrote: So... you plan on rendering more than 1000 frames per second? I think in any case, even if the API allows it, you are probably not getting much better resolution on your non-wi

Re: High-resolution thread sleep

2017-12-15 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 15 December 2017 at 01:49:56 UTC, Steven Schveighoffer wrote: So... you plan on rendering more than 1000 frames per second? I think in any case, even if the API allows it, you are probably not getting much better resolution on your non-windows systems. Have you tried it anyway an

Re: weird exception on windows

2017-12-15 Thread Szabo Bogdan via Digitalmars-d-learn
On Friday, 15 December 2017 at 09:24:07 UTC, Kagamin wrote: Try printf debugging in case argument is invalid. ah .. ok ... I tried to debug the issue and it looks like the filename is valid and there is no null value. I am thinking that the value is destroyed before it reach the `GetFileAt

Re: Templates Instantiation error

2017-12-15 Thread drug via Digitalmars-d-learn
15.12.2017 11:49, yes9111 пишет: Hey Y'all, I'm trying to write a simple utility class to read rows from a SQLite3 database using compile time parameters, but I've run into a weird problem. https://pastebin.com/eTnbRjEd If I try to instantiate a Reader class I'm hitting a linker error saying

Re: weird exception on windows

2017-12-15 Thread Kagamin via Digitalmars-d-learn
Try printf debugging in case argument is invalid.

Re: overload

2017-12-15 Thread Biotronic via Digitalmars-d-learn
On Thursday, 14 December 2017 at 22:47:15 UTC, dark777 wrote: I know that this community is not from c ++, but for some time I studied how to do overload of ostream operators in c ++ and I even managed to get to this result, I got to this result in another post done here but I did not understan

Templates Instantiation error

2017-12-15 Thread yes9111 via Digitalmars-d-learn
Hey Y'all, I'm trying to write a simple utility class to read rows from a SQLite3 database using compile time parameters, but I've run into a weird problem. https://pastebin.com/eTnbRjEd If I try to instantiate a Reader class I'm hitting a linker error saying Error 42: Symbol Undefined _s