【发布时间】:2010-10-05 15:10:52
【问题描述】:
我有一个类似的课程:
template <class T>
class bag
{
public:
private:
typedef struct{void* prev; struct{T item; unsigned int count;} body; void* next;}* node;
typedef struct{
node operator->() { return current; }
operator(){;} // <- i can not do that, right?
private:
node current;
} iterator;
//...
};
那么,如何为 bag::iterator 编写构造函数?
【问题讨论】:
-
一个“无名”结构被称为匿名。
-
@Peter G.:不是匿名的,这是“在 typedef 声明中定义的未命名类”
7.1.3/5 -
谢谢 Cubbi,我的立场是正确的。
标签: c++