override toString() for a tuple?

2014-06-03 Thread Steve D via Digitalmars-d-learn
Is it possible to override std tuple's toString format? so that auto a = tuple("hello",1,2,3); writeln(a); prints ("hello", 1, 2, 3) and not Tuple!(string, int, int, int)("hello", 1, 2, 3) I'm aware I could write a custom formatter function, but it would be nic

Re: override toString() for a tuple?

2014-06-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Wed, 04 Jun 2014 05:35:18 + Steve D via Digitalmars-d-learn wrote: > Is it possible to override std tuple's toString format? > > so that > auto a = tuple("hello",1,2,3); > writeln(a); > > prints > ("hello", 1, 2, 3) > and not > Tuple!(string, int, int, i

Re: override toString() for a tuple?

2014-06-03 Thread Steve D via Digitalmars-d-learn
On Wednesday, 4 June 2014 at 06:04:22 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: toString is a member of Tuple, and there's no way to override that externally. ... Hi Jonathan, Yeah, I'll probably just keep my locally cobbled version of typecons.d in my path. The other options wou

Re: override toString() for a tuple?

2014-06-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Wed, 04 Jun 2014 06:25:53 + Steve D via Digitalmars-d-learn wrote: > You would think the promise of OO and Inheritance > would make it easy and free us from hacks like this ;) That would require using OO and inheritance, which has nothing to do with Tuple. ;) And actually, I find that I