Re: Re: class templates and static if

2012-02-27 Thread Tyler Jameson Little
 Parser!(Type.request) h = new Parser!(Type.request)(Hello world)

Wow, I was so close!  I had tried this:

Parser!Type.request h = new Parser!Type.request(Hello world);

but that didn't work. I didn't think about enclosing it in parens!

I didn't want to do subclassing, because my parser is a state-machine style
parser, so it's in a big switch. Pretty gross, but I would like it to be as
fast as possible. That's why I thought this model would be so cool, because
I could remove conditions from the generated code, and get rid of a lot of
the conditionals.

Thanks so much!


Re: Re: class templates and static if

2012-02-27 Thread H. S. Teoh
On Mon, Feb 27, 2012 at 09:29:25AM -0700, Tyler Jameson Little wrote:
  Parser!(Type.request) h = new Parser!(Type.request)(Hello world)

Even better:

auto h = new Parser!(Type.request)(Hello world);


T

-- 
First Rule of History: History doesn't repeat itself -- historians
merely repeat each other.


Re: Re: class templates and static if

2012-02-27 Thread Andrej Mitrovic
On 2/27/12, Tyler Jameson Little beatgam...@gmail.com wrote:
 That's why I thought this model would be so cool, because
 I could remove conditions from the generated code, and get rid of a lot of
 the conditionals.

I think Nick Sabalausky talks about this concept (removing
conditionals via compile-time features) in his article
http://www.semitwist.com/articles/EfficientAndFlexible/SinglePage/

Other articles from last year's contest:
http://prowiki.org/wiki4d/wiki.cgi?Article_Contest