10-4 explicit和=delete

10.4 explicit和=delete

​ 在下面的代码中,会报错:

struct type
{
type(long long) {}
explicit type(long) = delete;
}
void foo(type) {}

int main()
{
foo(type(58)); //报错
foo(58); //通过
}

​ 原因在于:type(58)会必定指向type(long),而type(long)被删除了。