C++ guys hate static_if?

Jonathan M Davis jmdavisProg at gmx.com
Sun Mar 10 19:39:28 PDT 2013


On Saturday, March 09, 2013 01:48:55 DypthroposTheImposter wrote:
>         See the static_if paper here:
> 
> http://isocpp.org/forums
> 
> Under the post "constraints and static if" there is a link to a
> document about
> static_if
> 
> https://docs.google.com/viewer?a=v&pid=forums&srcid=MDIyMDc3NjUwMTczOTM0Mjk3
> NjABMDI2MzM3MjkxNDM4NDQ5MzE4NDcBLWVsS1Y4dFhtdDhKATUBaXNvY3BwLm9yZwF2Mg
> 
>        Are they full of it? Has it caused the problems they mention
> in
> D?

I haven't read the paper, so I really don't know what problems they see with 
static if, and C++ _is_ a very different beast than D (particularly with 
regards to stuff done at compile time), but without statif if, C++ seems very 
crippled with regards to templates and conditional compilaton. The combination 
of template constraints and static ifs is _extremely_ powerful in D, and it 
works very well. C++ currently lacks anything of the sort, and until it does, 
it's templates will be very much inferior to D's. Maybe they can gain similar 
power through different mechanisms, but I'm surprised that anyone would think 
that static if was such a bad idea. It's working fantastically well for us, 
and I don't know how we'd get along without it.

- Jonathan M Davis


More information about the Digitalmars-d mailing list