Re: Erroneous "auto can only be used for template function parameters"?

2015-06-19 Thread Yuxuan Shui via Digitalmars-d-learn
On Saturday, 20 June 2015 at 01:50:11 UTC, Yuxuan Shui wrote: Try to compile this code snippet: import std.traits; template a(R) { auto a(S)(auto ref R i) { return cast(S)i*2; } } template ReturnTypeEx(alias A, B) { alias ReturnTypeEx = ReturnType!(A!B); }

Erroneous "auto can only be used for template function parameters"?

2015-06-19 Thread Yuxuan Shui via Digitalmars-d-learn
Try to compile this code snippet: import std.traits; template a(R) { auto a(S)(auto ref R i) { return cast(S)i*2; } } template ReturnTypeEx(alias A, B) { alias ReturnTypeEx = ReturnType!(A!B); } template b(alias R) { int b(S)(S i) {

Re: OT - civility in a professional environment

2015-06-19 Thread Robert burner Schadek via Digitalmars-d-learn
nice read, thank you

Re: best way to interface D code to Excel

2015-06-19 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 17 June 2015 at 18:35:36 UTC, Laeeth Isharc wrote: Hi. I know D has support for COM - not sure of its status. And there was a Microsoft chap who posted here a couple of years back - wonderful templated code that made it easy to write this kind of thing. Unfortunately he wasn't

OT - civility in a professional environment

2015-06-19 Thread Laeeth Isharc via Digitalmars-d-learn
http://www.nytimes.com/2015/06/21/opinion/sunday/is-your-boss-mean.html?_r=0 Off topic, but perhaps of interest. Laeeth.

Re: Return types of the methods of a struct

2015-06-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/19/15 12:09 PM, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 14:42:59 UTC, Steven Schveighoffer wrote: On 6/19/15 10:13 AM, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 14:04:05 UTC, Daniel Kozák wrote: On Fri, 19 Jun 2015 13:52:52 + Quentin Ladeveze via Digitalmars-d-lea

Re: Are stack+heap classes possible in D?

2015-06-19 Thread rsw0x via Digitalmars-d-learn
On Friday, 19 June 2015 at 19:10:11 UTC, Shachar Shemesh wrote: On 14/06/15 04:31, Adam D. Ruppe wrote: On Sunday, 14 June 2015 at 00:52:20 UTC, FujiBar wrote: I have read that in D structs are always allocated on the stack while classes are always allocated on the heap. That's not true; it

Re: Are stack+heap classes possible in D?

2015-06-19 Thread Shachar Shemesh via Digitalmars-d-learn
On 14/06/15 04:31, Adam D. Ruppe wrote: On Sunday, 14 June 2015 at 00:52:20 UTC, FujiBar wrote: I have read that in D structs are always allocated on the stack while classes are always allocated on the heap. That's not true; it is a really common misconception. Putting a struct on the heap is

Re: Return types of the methods of a struct

2015-06-19 Thread Quentin Ladeveze via Digitalmars-d-learn
On Friday, 19 June 2015 at 15:47:09 UTC, ZombineDev wrote: On Friday, 19 June 2015 at 14:13:46 UTC, Quentin Ladeveze wrote: [..] These are interesting and can be useful, but allMembers returns strings and not functions, so I can't apply ReturnType. Here's my solution: http://dpaste.dzfl.pl/c6

Re: Return types of the methods of a struct

2015-06-19 Thread Quentin Ladeveze via Digitalmars-d-learn
On Friday, 19 June 2015 at 15:36:54 UTC, Justin Whear wrote: On Fri, 19 Jun 2015 13:27:13 +, Quentin Ladeveze wrote: Is there any way to have a asTuple method in this struct that would returns something like : Tuple!(int, "a", float, "b", string, "c") and that will contain the values of

Re: Return types of the methods of a struct

2015-06-19 Thread Quentin Ladeveze via Digitalmars-d-learn
On Friday, 19 June 2015 at 14:42:59 UTC, Steven Schveighoffer wrote: On 6/19/15 10:13 AM, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 14:04:05 UTC, Daniel Kozák wrote: On Fri, 19 Jun 2015 13:52:52 + Quentin Ladeveze via Digitalmars-d-learn wrote: On Friday, 19 June 2015 at 13:38:4

Re: Return types of the methods of a struct

2015-06-19 Thread ZombineDev via Digitalmars-d-learn
On Friday, 19 June 2015 at 14:13:46 UTC, Quentin Ladeveze wrote: [..] These are interesting and can be useful, but allMembers returns strings and not functions, so I can't apply ReturnType. Here's my solution: http://dpaste.dzfl.pl/c69de3c16d75

Re: Return types of the methods of a struct

2015-06-19 Thread Justin Whear via Digitalmars-d-learn
On Fri, 19 Jun 2015 13:27:13 +, Quentin Ladeveze wrote: > > Is there any way to have a asTuple method in this struct that would > returns something like : > > Tuple!(int, "a", float, "b", string, "c") > > and that will contain the values of the methods of the struct ? > > Thanks. You'll wa

Re: Return types of the methods of a struct

2015-06-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/19/15 10:13 AM, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 14:04:05 UTC, Daniel Kozák wrote: On Fri, 19 Jun 2015 13:52:52 + Quentin Ladeveze via Digitalmars-d-learn wrote: On Friday, 19 June 2015 at 13:38:45 UTC, Steven Schveighoffer wrote: > > Does this work for you, or is

Re: Return types of the methods of a struct

2015-06-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/19/15 10:01 AM, Baz wrote: On Friday, 19 June 2015 at 13:52:54 UTC, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 13:38:45 UTC, Steven Schveighoffer wrote: Does this work for you, or is there a further expectation? auto asTuple() { return Tuple!(int, "a", ...)(a, b, stringValue);}

Re: Return types of the methods of a struct

2015-06-19 Thread Quentin Ladeveze via Digitalmars-d-learn
On Friday, 19 June 2015 at 14:04:05 UTC, Daniel Kozák wrote: On Fri, 19 Jun 2015 13:52:52 + Quentin Ladeveze via Digitalmars-d-learn wrote: On Friday, 19 June 2015 at 13:38:45 UTC, Steven Schveighoffer wrote: > > Does this work for you, or is there a further expectation? > > auto asTuple

Re: Return types of the methods of a struct

2015-06-19 Thread Baz via Digitalmars-d-learn
On Friday, 19 June 2015 at 13:52:54 UTC, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 13:38:45 UTC, Steven Schveighoffer wrote: Does this work for you, or is there a further expectation? auto asTuple() { return Tuple!(int, "a", ...)(a, b, stringValue);} -Steve In fact, I was trying

Re: Return types of the methods of a struct

2015-06-19 Thread Daniel Kozák via Digitalmars-d-learn
On Fri, 19 Jun 2015 13:52:52 + Quentin Ladeveze via Digitalmars-d-learn wrote: > On Friday, 19 June 2015 at 13:38:45 UTC, Steven Schveighoffer > wrote: > > > > Does this work for you, or is there a further expectation? > > > > auto asTuple() { return Tuple!(int, "a", ...)(a, b, > > stringV

Re: Return types of the methods of a struct

2015-06-19 Thread Quentin Ladeveze via Digitalmars-d-learn
On Friday, 19 June 2015 at 13:38:45 UTC, Steven Schveighoffer wrote: Does this work for you, or is there a further expectation? auto asTuple() { return Tuple!(int, "a", ...)(a, b, stringValue);} -Steve In fact, I was trying to use traits to create the tuple automatically and being able to

Re: Return types of the methods of a struct

2015-06-19 Thread Baz via Digitalmars-d-learn
On Friday, 19 June 2015 at 13:40:01 UTC, Baz wrote: On Friday, 19 June 2015 at 13:27:15 UTC, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 13:26:03 UTC, Steven Schveighoffer wrote: [...] Thank you :) Here is th corrected version : Hi, I have a struct with some methods int it, let's

Re: Return types of the methods of a struct

2015-06-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/19/15 9:27 AM, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 13:26:03 UTC, Steven Schveighoffer wrote: On 6/19/15 9:13 AM, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 13:12:08 UTC, Quentin Ladeveze wrote: Hi, I have a struct with some methods int it, let's say ``` struct E

Re: Return types of the methods of a struct

2015-06-19 Thread Baz via Digitalmars-d-learn
On Friday, 19 June 2015 at 13:27:15 UTC, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 13:26:03 UTC, Steven Schveighoffer wrote: On 6/19/15 9:13 AM, Quentin Ladeveze wrote: [...] You can't. The forum is backed by a newsgroup, just post the full corrected version :) -Steve Thank you

Re: Return types of the methods of a struct

2015-06-19 Thread Quentin Ladeveze via Digitalmars-d-learn
On Friday, 19 June 2015 at 13:26:03 UTC, Steven Schveighoffer wrote: On 6/19/15 9:13 AM, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 13:12:08 UTC, Quentin Ladeveze wrote: Hi, I have a struct with some methods int it, let's say ``` struct Example{ int intValue(){ Hum. How can I d

Re: Return types of the methods of a struct

2015-06-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/19/15 9:13 AM, Quentin Ladeveze wrote: On Friday, 19 June 2015 at 13:12:08 UTC, Quentin Ladeveze wrote: Hi, I have a struct with some methods int it, let's say ``` struct Example{ int intValue(){ Hum. How can I delete a post ? You can't. The forum is backed by a newsgroup, just p

Return types of the methods of a struct

2015-06-19 Thread Quentin Ladeveze via Digitalmars-d-learn
Hi, I have a struct with some methods int it, let's say ``` struct Example{ int intValue(){

Re: Return types of the methods of a struct

2015-06-19 Thread Quentin Ladeveze via Digitalmars-d-learn
On Friday, 19 June 2015 at 13:12:08 UTC, Quentin Ladeveze wrote: Hi, I have a struct with some methods int it, let's say ``` struct Example{ int intValue(){ Hum. How can I delete a post ?

Re: best way to interface D code to Excel

2015-06-19 Thread Kagamin via Digitalmars-d-learn
On Thursday, 18 June 2015 at 11:36:50 UTC, Arjan wrote: See the 'COM in plain C' articles by Jeff Glatt which demonstrate how to do it using C. This might give you the information needed to do it using D. http://www.codeproject.com/Articles/Jeff-Glatt#articles. It's a little misleading though