关于模板

来源:百度知道 编辑:UC知道 时间:2024/06/08 10:00:32
template<typename D, typename B>
class IsDerivedFrom1
{
class No { };
class Yes { No no[2]; };

static Yes Test( B* ); // declared, but not defined
static No Test( ... ); // declared, but not defined

public:
enum { Is = sizeof(Test(static_cast<D*>(0))) == sizeof(Yes) };
};
以上的模板定义中像static No Test( ... );这样的函数声明,参数...的用法是怎么回事,请懂的人给解释一下,谢谢。

static No Test( ... );中的...表示可变参数声明,例如,c库函数printf(...)中的参数就是不定个数的

初学C的人都会用printf(),可是好像没几个会去看printf()的函数原型~~