且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

模板成员函数是否可能存在异常的限制?

更新时间:2023-11-27 18:49:16

声明中的返回类型必须与定义匹配。

The return type in the declaration must match the definition.

struct A {
    template <typename T>
    typename std::enable_if<(sizeof(T) > 4), void>::type
    foo(T a); 
};

SFINAE不能封装为实现细节。

SFINAE cannot be encapsulated as an implementation detail.

演示