SFINAE - 模板中的enable_if

ref : https://github.com/wuye9036/CppTemplateTutorial#323-特化一些其它问题


这段就是说: 这个int实参在替换第一个inc_counter时,enable_if<false>,所以直接替换失败。接下来替换第二个inc_counter,enable_if<true>,那么就会产生一个void inc_counter<int>(int & counterInt, void* dummy = nullptr);的函数签名,就替换成功了。

posted @ 2023-01-16 23:29  ijpq  阅读(16)  评论(0编辑  收藏  举报