Re: How to instantiate a map with multiple functions

2015-12-26 Thread Fusxfaranto via Digitalmars-d-learn
On Saturday, 26 December 2015 at 19:30:24 UTC, karthikeyan wrote: How to instantiate a map with multiple functions. I looked into the docs at http://dlang.org/phobos/std_algorithm_iteration.html#map. They contain a string which I suppose is a mixin and when I change "a" to some other name it

Re: How to check if JSONValue of type object has a key?

2015-10-06 Thread Fusxfaranto via Digitalmars-d-learn
On Tuesday, 6 October 2015 at 20:44:30 UTC, via Digitalmars-d-learn wrote: On Tue, Oct 06, 2015 at 08:28:46PM +, Borislav Kosharov via Digitalmars-d-learn wrote: JSONValue root = parseJSON(text); if(root["key"].isNull == false) { try if("key" in root) { // it is there } else {

Re: Checking that a template parameter is an enum

2015-09-30 Thread Fusxfaranto via Digitalmars-d-learn
On Thursday, 1 October 2015 at 00:04:18 UTC, Nordlöw wrote: How do I check that a template parameter is a CT-value or an enum symbol? I want this to restrict the following template: /** Returns: true iff all values $(D V) are the same. */ template allSame(V...) // TODO restrict to

Re: Trouble with template parameter matching

2015-08-02 Thread Fusxfaranto via Digitalmars-d-learn
On Sunday, 2 August 2015 at 08:08:05 UTC, tcak wrote: [code] void func1(N)( const N name ) if( is(N: string) || is(N: char[]) ) { func2( name ); } [...] This seems like the reasonable behavior to me. Perhaps you should use Unqual?

Re: Are Lua tables possible to do with D?

2015-07-16 Thread Fusxfaranto via Digitalmars-d-learn
On Thursday, 16 July 2015 at 06:48:12 UTC, Robert M. Münch wrote: Hi, do you think it's possible to implemented something like Lua Tables (a hashed heterogeneous associative array) in D? I know that Lua is dynamic and interpreted, hence it's a lot simpler to do than with a compiled language