In C++11 kann man von einer Funktion erben. Krass. Lambdas sind krass. Das typedef musste sein, sonst hat er nicht compiliert. Ist vllt aber nur ein Compilerbug und bald nicht mehr nötig. auto foo = [](){return 42;}; class DerivedFunctor : public decltype(foo) { typedef decltype(foo) type; public: DerivedFunctor(type foo) : type(foo) { } auto operator()() […]
29.07.2015
26.07.2015
Replace runtime constant wich template variables
void version1(int i, int h) { // if(h) is evaluated every call if(h==0) { } else if(h==1) { } else { } } template void version2(int i) { // if(h) is evaluated at compile time if(h==0) { } else if(h==1) { } else { } } void func(int h) { // h is a runtime […]
Comments Off on Replace runtime constant wich template variables