Damn C++ and damn D!

so so at so.so
Sun Feb 5 06:53:26 PST 2012


On Sunday, 5 February 2012 at 14:24:20 UTC, Timon Gehr wrote:

> This should work:
>
> #define DOTDOTDOT ...
>
> template<class T> void fun(T a){
>    if(cond<T>::value) {
>        auto var = make(a);
>        DOTDOTDOT;
>    }else{
>        auto tmp = make(a);
>        auto var = make_proxy(tmp);
>        DOTDOTDOT;
>    }
> }

It won't work.
You now have two scopes and you have to repeat every line after 
"var" for both scopes. Now you have to maintain both of them. And 
this grows exponentially for every new condition you have.




More information about the Digitalmars-d mailing list