Using non-const expression as template parameter

非 Y 不嫁゛ 提交于 2019-12-06 02:35:43

You'd need to do a compile-time iteration along the lines of

template <typename fun, size_t i> struct print_helper {
    static void print() {
        print_helper<fun, i-1>::print();
        std::cout << std::is_same<int, typename function_traits<fun>::template arg<i-1>::type>::value << std::endl;
    }
};

template <typename fun> struct print_helper<fun,0> {
    static void print() {}
};

template <typename fun> void print() {
    print_helper<fun, function_traits<fun>::nargs>::print();
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!