如果我有一个功能
int calcStuff_dynamic(const int a, const int b)
和一些模板元代码
template<int a, int b>
struct calcStuff_static {
static const int value = //some more code
};
有没有办法写一个包装
int calcStuff(const int a, const int b) {
IF_THESE_ARE_KNOWN_CONSTANTS_AT_COMPILE_TIME(a, b)
return calcStuff_static<a, b>::value;
ELSE_TEMPLATE_WOULD_FAIL
return calcStuff_dynamic(a, b);
}