• 全部
  • 问答

什么是complete type?

heroboy2000 2005-01-23 09:41:56
什么是complete type?

还有
T p;和
T p();有什么区别吗?

对于boost::tuple
tuple<> a();
cout<<a;

tuple<> b;
cout<<b;
是不一样的,其中一个是连接错误
...全文
89 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
heroboy2000 2005-01-26
每人回答最主要的问题吗?我自己来回答算了。我在msdn中找到了
An incomplete type is a type that describes an identifier but lacks information needed to determine the size of the identifier. An "incomplete type" can be:
A structure type whose members you have not yet specified.
A union type whose members you have not yet specified.
An array type whose dimension you have not yet specified.
The void type is an incomplete type that cannot be completed. To complete an incomplete type, specify the missing information. The following examples show how to create and complete the incomplete types.
To create an incomplete structure type, declare a structure type without specifying its members. In this example, the ps pointer points to an incomplete structure type called student.
struct student *ps;
To complete an incomplete structure type, declare the same structure type later in the same scope with its members specified, as in
struct student
{
int num;
} /* student structure now completed */
To create an incomplete array type, declare an array type without specifying its repetition count. For example:
char a[]; /* a has incomplete type */
To complete an incomplete array type, declare the same name later in the same scope with its repetition count specified, as in
char a[25]; /* a now has complete type */
回复
somedummy 2005-01-23
另外,还有一个比较BT的地方譬如
int func(T p()),这个时候也是一个T p()代表的是一个函数指针,让人ft吧?
回复
playmud 2005-01-23
T p;//p是类型为T的实例
T p();//返回类型为T的函数
回复
somedummy 2005-01-23
T p()是声明一个p函数,返回值是T,这个参见blog.csdn.net/Jinhao,里面有一篇文章讲这个(在混沌in C++里面)

链接错误的应该是b的那个吧?
回复
相关推荐
发帖
C++ 语言
创建于2007-09-28

5.9w+

社区成员

C++ 语言相关问题讨论,技术干货分享,前沿动态等
申请成为版主
帖子事件
创建了帖子
2005-01-23 09:41
社区公告
暂无公告