代碼如下:
template <typename T>
class foo
{
public:
class bar
{
public:
bar() {}
bar(const bar &) {}
bar(int) {}
operator T *() const
{
return 0;
}
bar operator + (int)
{
return *this;
}
};
};
int main()
{
foo<int>::bar f;
size_t i = 1;
f + i;
return 0;
}
注意:外層 class foo 和 template 都不能去掉。
這個(gè)代碼應(yīng)該通過編譯么?還是應(yīng)該報(bào)operator +匹配歧義?
posted on 2010-10-15 15:01
溪流 閱讀(2436)
評論(6) 編輯 收藏 引用 所屬分類:
C++