On 02/05/2012 02:49 PM, so wrote:
After some time with D, C++ is now a nightmare for me. (especially on
generic coding)
Think about replicating this simple code in C++.

void fun(T)(T a)
{
static if(cond(T))
{
auto var = make(a);
}
else
{
auto tmp = make(a);
auto var = make_proxy(tmp);
}
...
}

And this is just "one" condition.
Damn D for introducing these and damn C++ committee for not adopting.

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;
    }
}

Reply via email to