Re: Map and arrays

2010-11-28 Thread bearophile
Tom: What should I do? Is there some way to get the original array type? This code shows two ways to solve your problem: import std.stdio: writeln; import std.algorithm: map; import std.conv: to; import std.traits: ForeachType; import std.array: array; void foo(Range)(Range srange) if

Re: Is there a way to forward-declare interfaces to avoid module interdependencies?

2010-11-28 Thread Per Ångström
On 2010-11-15 16:52, Steven Schveighoffer wrote: On Sun, 14 Nov 2010 05:28:29 -0500, Per Ångström d-n...@autark.se wrote: Fortunately, by separating interface and implementation, one can at least keep the implementation modules free from interdependencies. It's not perfect but it's not a

Re: bigint

2010-11-28 Thread Matthias Walter
On 11/27/2010 02:05 PM, bearophile wrote: Reduced case for bugzilla: http://d.puremagic.com/issues/show_bug.cgi?id=5281 I investigated into the bug and the reason is the signature of opEquals, which currently is bool opEquals(Tdummy=void)(ref const BigInt y) const bool opEquals(T:

Re: Map and arrays

2010-11-28 Thread spir
On Sun, 28 Nov 2010 06:19:00 -0500 bearophile bearophileh...@lycos.com wrote: Tom: What should I do? Is there some way to get the original array type? [...] void foo(Range)(Range srange) if (is(ForeachType!Range == string)) { writeln(srange); } [...] If you want to simplify your

Re: bigint

2010-11-28 Thread Kagamin
Matthias Walter Wrote: bool opEquals(Tdummy=void)(ref const BigInt y) const bool opEquals(T: int)(T y) const The only working sigature for array-of-structs-comparison to work is bool opEquals(ref const BigInt y) const But this removes the ability to compare against ints. Why are they

Re: Map and arrays

2010-11-28 Thread Tom
El 28/11/2010 04:11, Jonathan M Davis escribió: On Saturday 27 November 2010 22:48:28 Tom wrote: Hi, I wonder how to solve this kind of stuff... void foo(string[] sarray) { // do something with sarray } void bar(int[] iarray) { auto sarray = map!(to!string)(iarray);

Re: Map and arrays

2010-11-28 Thread Tom
El 28/11/2010 08:19, bearophile escribió: Tom: What should I do? Is there some way to get the original array type? This code shows two ways to solve your problem: import std.stdio: writeln; import std.algorithm: map; import std.conv: to; import std.traits: ForeachType; import std.array:

Re: Base64 - Encoding and decoding

2010-11-28 Thread Kagamin
Nrgyzer Wrote: decode(to!(string)(content)); check out, what you send to decode function. the code... /3_=

Re: bigint

2010-11-28 Thread Don
Kagamin wrote: Matthias Walter Wrote: bool opEquals(Tdummy=void)(ref const BigInt y) const bool opEquals(T: int)(T y) const The only working sigature for array-of-structs-comparison to work is bool opEquals(ref const BigInt y) const But this removes the ability to compare against ints.

Re: Map and arrays

2010-11-28 Thread bearophile
Tom: Also I wish to point out that the layout and presentation of some of phobos ddoc pages are, IMHO and as I said before, a little bit of a mess. Wish they could look more like javadoc, or at least more organized. D docs will surely need improvements, but I don't think they will look like

Re: Map and arrays

2010-11-28 Thread Jonathan M Davis
On Sunday 28 November 2010 11:37:26 Tom wrote: El 28/11/2010 04:11, Jonathan M Davis escribió: On Saturday 27 November 2010 22:48:28 Tom wrote: Hi, I wonder how to solve this kind of stuff... void foo(string[] sarray) { // do something with sarray } void

Re: Map and arrays

2010-11-28 Thread Tom
El 28/11/2010 20:37, Jonathan M Davis escribió: On Sunday 28 November 2010 11:37:26 Tom wrote: El 28/11/2010 04:11, Jonathan M Davis escribió: On Saturday 27 November 2010 22:48:28 Tom wrote: Hi, I wonder how to solve this kind of stuff... void foo(string[] sarray) { // do something

Re: Map and arrays

2010-11-28 Thread Tom
El 29/11/2010 01:58, Jonathan M Davis escribió: On Sunday 28 November 2010 19:53:36 Tom wrote: I'm not criticizing ddoc color or fonts. I mean, for example, in the index of symbols at the beginning of every ddoc page, there are functions, constants, classes, and templates, all mixed and each

Re: Map and arrays

2010-11-28 Thread Jonathan M Davis
On Sunday 28 November 2010 21:49:19 Tom wrote: El 29/11/2010 01:58, Jonathan M Davis escribió: On Sunday 28 November 2010 19:53:36 Tom wrote: I'm not criticizing ddoc color or fonts. I mean, for example, in the index of symbols at the beginning of every ddoc page, there are functions,