Re: Decoding Pattern to a Tuple

2016-02-22 Thread Artur Skawina via Digitalmars-d-learn
On 02/19/16 19:10, Nordlöw via Digitalmars-d-learn wrote: > Have anybody put together a generalised form of findSplit that can split and > decode using a compile time parameters somewhat like > > "(1)-(2.0)".decode!("(", int, ")", char, "(", double, ")") > > evaluates to > > to a > > tuple!(in

Re: Decoding Pattern to a Tuple

2016-02-22 Thread Nordlöw via Digitalmars-d-learn
On Friday, 19 February 2016 at 22:16:10 UTC, Ali Çehreli wrote: On 02/19/2016 11:04 AM, Ali Çehreli wrote: > can be templatized: Not ready for prime time but now it's templatized: Thanks!

Re: Decoding Pattern to a Tuple

2016-02-19 Thread Ali Çehreli via Digitalmars-d-learn
On 02/19/2016 11:04 AM, Ali Çehreli wrote: > can be templatized: Not ready for prime time but now it's templatized: import std.stdio; import std.string; import std.regex; import std.typecons; import std.conv; import std.algorithm; import std.range; template regexClass(T) { static if (is (T

Re: Decoding Pattern to a Tuple

2016-02-19 Thread Ali Çehreli via Digitalmars-d-learn
On 02/19/2016 10:10 AM, Nordlöw wrote: Have anybody put together a generalised form of findSplit that can split and decode using a compile time parameters somewhat like "(1)-(2.0)".decode!("(", int, ")", char, "(", double, ")") evaluates to to a tuple!(int, char, double) with value tuple(1,

Decoding Pattern to a Tuple

2016-02-19 Thread Nordlöw via Digitalmars-d-learn
Have anybody put together a generalised form of findSplit that can split and decode using a compile time parameters somewhat like "(1)-(2.0)".decode!("(", int, ")", char, "(", double, ")") evaluates to to a tuple!(int, char, double) with value tuple(1, '-', 2.0)