什么是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;
是不一样的,其中一个是连接错误
...全文
171 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
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的那个吧?

64,649

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧