Re: getting current DateTime

2014-12-30 Thread bitwise via Digitalmars-d-learn
It would be nice if that cast was made implicit though. Just realizing now that DateTime doesn't have sub-second accuracy =/

Re: getting current DateTime

2014-12-30 Thread bitwise via Digitalmars-d-learn
On Wednesday, 31 December 2014 at 06:31:13 UTC, ketmar via Digitalmars-d-learn wrote: On Wed, 31 Dec 2014 06:03:04 + bitwise via Digitalmars-d-learn wrote: How do you get the current DateTime? Why doesn't DateTime have DateTime.now? but it has! ;-) auto now = cast(DateTime)Clock.currTi

Re: getting current DateTime

2014-12-30 Thread ketmar via Digitalmars-d-learn
On Wed, 31 Dec 2014 06:03:04 + bitwise via Digitalmars-d-learn wrote: > How do you get the current DateTime? > Why doesn't DateTime have DateTime.now? but it has! ;-) auto now = cast(DateTime)Clock.currTime; signature.asc Description: PGP signature

Re: getting current DateTime

2014-12-30 Thread FrankLike via Digitalmars-d-learn
On Wednesday, 31 December 2014 at 06:03:06 UTC, bitwise wrote: How do you get the current DateTime? Why doesn't DateTime have DateTime.now? import std.stdio; import std.datetime; void main() { writeln(Clock.currTime); } Frank

getting current DateTime

2014-12-30 Thread bitwise via Digitalmars-d-learn
How do you get the current DateTime? Why doesn't DateTime have DateTime.now?

Re: Fastest Way to Append Multiple Elements to an Array

2014-12-30 Thread Damian via Digitalmars-d-learn
On Friday, 26 December 2014 at 16:31:48 UTC, Nordlöw wrote: On Friday, 26 December 2014 at 16:29:56 UTC, Nordlöw wrote: See my update at https://github.com/nordlow/justd/blob/master/algorithm_ex.d#L1602 which tries to merge all the ideas into one adapting algorithm :) Destroy! BTW: 1. Is

Re: Fastest Way to Append Multiple Elements to an Array

2014-12-30 Thread Nordlöw
On Saturday, 27 December 2014 at 07:34:43 UTC, Tobias Pankrath wrote: On Friday, 26 December 2014 at 16:31:48 UTC, Nordlöw wrote: On Friday, 26 December 2014 at 16:29:56 UTC, Nordlöw wrote: See my update at https://github.com/nordlow/justd/blob/master/algorithm_ex.d#L1602 which tries to merge

Re: Idea/request: If you have a DUB project, add a code.dlang.org badge to README

2014-12-30 Thread jklp via Digitalmars-d-learn
On Tuesday, 30 December 2014 at 21:23:53 UTC, Kiith-Sa wrote: On Tuesday, 30 December 2014 at 21:19:52 UTC, jklp wrote: On Tuesday, 30 December 2014 at 21:12:38 UTC, Kiith-Sa wrote: A few weeks/months ago someone here mentioned that it'd be good if DUB projects linked to code.dlang.org to help

Re: Idea/request: If you have a DUB project, add a code.dlang.org badge to README

2014-12-30 Thread Kiith-Sa via Digitalmars-d-learn
On Tuesday, 30 December 2014 at 21:19:52 UTC, jklp wrote: On Tuesday, 30 December 2014 at 21:12:38 UTC, Kiith-Sa wrote: A few weeks/months ago someone here mentioned that it'd be good if DUB projects linked to code.dlang.org to help anyone who runs into such a project quickly discover other D p

Re: Idea/request: If you have a DUB project, add a code.dlang.org badge to README

2014-12-30 Thread Kiith-Sa via Digitalmars-d-learn
On Tuesday, 30 December 2014 at 21:19:52 UTC, jklp wrote: On Tuesday, 30 December 2014 at 21:12:38 UTC, Kiith-Sa wrote: A few weeks/months ago someone here mentioned that it'd be good if DUB projects linked to code.dlang.org to help anyone who runs into such a project quickly discover other D p

Re: Idea/request: If you have a DUB project, add a code.dlang.org badge to README

2014-12-30 Thread jklp via Digitalmars-d-learn
On Tuesday, 30 December 2014 at 21:12:38 UTC, Kiith-Sa wrote: A few weeks/months ago someone here mentioned that it'd be good if DUB projects linked to code.dlang.org to help anyone who runs into such a project quickly discover other D projects. MAny GitHub projects have "badges"/"shields" on

Idea/request: If you have a DUB project, add a code.dlang.org badge to README

2014-12-30 Thread Kiith-Sa via Digitalmars-d-learn
A few weeks/months ago someone here mentioned that it'd be good if DUB projects linked to code.dlang.org to help anyone who runs into such a project quickly discover other D projects. MAny GitHub projects have "badges"/"shields" on top of their READMEs - little image strips showing things like

Re: Is it possible to use an UDA to generate a struct inside a class ?

2014-12-30 Thread Basile Burg via Digitalmars-d-learn
On Tuesday, 30 December 2014 at 19:05:23 UTC, Ali Çehreli wrote: On 12/30/2014 09:42 AM, Basile Burg wrote: > Can a descriptor be created using my "attribute" ? How ? Here is a quick and dirty solution: import std.string; struct PropertyDescriptor { string type; string name; stri

Re: Define methods using templates

2014-12-30 Thread Ali Çehreli via Digitalmars-d-learn
On 12/30/2014 05:17 AM, Claude wrote: > use templates to define several methods (property > setters) within a class to avoid some code duplication. I just saw this post, which is essentially the same question as Basile Burg's. I hope that a college (in France?) is teaching D and that this is a

Re: Is it possible to use an UDA to generate a struct inside a class ?

2014-12-30 Thread Ali Çehreli via Digitalmars-d-learn
On 12/30/2014 09:42 AM, Basile Burg wrote: > Can a descriptor be created using my "attribute" ? How ? Here is a quick and dirty solution: import std.string; struct PropertyDescriptor { string type; string name; string memberName() @property const { return name ~ "_";

Is it possible to use an UDA to generate a struct inside a class ?

2014-12-30 Thread Basile Burg via Digitalmars-d-learn
I have a struct used to describe a property[1]. Its standard usage is represented in this simple example: |class Bar { |private uint fField0; |private izPropDescriptor!uint descrField0; |this() { |descrField0.define(&field0, &field0, "field0"); |} |public void field0(

Re: Define methods using templates

2014-12-30 Thread Claude via Digitalmars-d-learn
Thanks Steven and Daniel for your explanations. mixin template opAssign(alias Field) { void opAssign(Tin)(auto ref Tin param) @property pure @safe { Field = param; m_matrixCalculated = false; } } mixin opAssign!(m_pos) pos; I tes

Do you have any idea about deleting exe's symbol table on windows building by DMD or LDC2 64 bit?

2014-12-30 Thread FrankLike via Digitalmars-d-learn
Do you have any idea about deleting exe's symbol table on windows? I know mingw for win32 is ok. do you have any other idea about building by DMD or or LDC2 64 bit? Thank you.

Re: Define methods using templates

2014-12-30 Thread Daniel Kozák via Digitalmars-d-learn
V Tue, 30 Dec 2014 13:17:08 + Claude via Digitalmars-d-learn napsáno: > Hello, I'm trying to use templates to define several methods > (property setters) within a class to avoid some code duplication. > Here is an attempt: > > class Camera > { > private: > Vector4 m_pos; > float m

Re: Define methods using templates

2014-12-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/30/14 8:48 AM, Steven Schveighoffer wrote: I think it has to do with the fact that when you are defining the aliases, m_pos for example, is an *instance* member so requires an instance to get an alias. What you are probably better off doing is: void SetProperty(Tin, string Field)(ref Tin

Re: Define methods using templates

2014-12-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/30/14 8:17 AM, Claude wrote: Hello, I'm trying to use templates to define several methods (property setters) within a class to avoid some code duplication. Here is an attempt: class Camera { private: Vector4 m_pos; float m_fov, m_ratio, m_near, m_far; bool m_matrixCalculated

Define methods using templates

2014-12-30 Thread Claude via Digitalmars-d-learn
Hello, I'm trying to use templates to define several methods (property setters) within a class to avoid some code duplication. Here is an attempt: class Camera { private: Vector4 m_pos; float m_fov, m_ratio, m_near, m_far; bool m_matrixCalculated; public: void SetProperty(Tin, a