Question on Octal

2012-08-15 Thread Michael
Hi all, I have just read Walter's article about octals on Dr. Dobb's. As a newbie, I tried to create one myself. template octal(int n) { int toOct(int x) {...} enum octal = toOct(n); } void main() { import std.stdio : writeln; writeln(octal!10); } I

Re: Question on Octal

2012-08-15 Thread Jonathan M Davis
On Wednesday, August 15, 2012 19:49:53 Michael wrote: > Hi all, > I have just read Walter's article about octals on Dr. Dobb's. > As a newbie, I tried to create one myself. > > template octal(int n) { > int toOct(int x) {...} > > enum octal = toOct(n); > } > > void main() { > import std.stdio :

Re: Question on Octal

2012-08-15 Thread Simen Kjaeraas
On Wed, 15 Aug 2012 20:07:59 +0200, Jonathan M Davis wrote: 1) The specification is clear that the if the template has only one member and the member has the same name with the template's, the member is implicitly referred to in the instantiation. The template octal has two members, so the pr

Re: Question on Octal

2012-08-15 Thread Jonathan M Davis
On Thursday, August 16, 2012 06:14:23 Simen Kjaeraas wrote: > On Wed, 15 Aug 2012 20:07:59 +0200, Jonathan M Davis > > wrote: > >> 1) The specification is clear that the if the template has only > >> one member and the member has the same name with the template's, > >> the member is implicitly re