std :: vector的别名 [英] Alias for a std::vector

查看:207
本文介绍了std :: vector的别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过两个不同的名称在类中引用相同的std :: vector,

我尝试了一个联合,我尝试了一个引用,我似乎无法得到语法正确。

有人可以帮忙吗?谢谢

I am trying to refer to the same std::vector in a class by two different names,
I tried a union, and I tried a reference, I can''t seem to get the syntax right.
Can anyone please help? Thanks

推荐答案

Peter Olcott写道:
Peter Olcott wrote:

我试图引用同样的std :: vector在一个类中由两个

不同的名字,我尝试了一个联盟,我尝试了一个引用,我不能

似乎让语法正确。有人可以帮忙吗?谢谢
I am trying to refer to the same std::vector in a class by two
different names, I tried a union, and I tried a reference, I can''t
seem to get the syntax right. Can anyone please help? Thanks



见常见问题5.8。


V

-

请在通过电子邮件回复时删除资金''A'

我没有回复最热门的回复,请不要问

See FAQ 5.8.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


struct Test {

union {

std :: vector< intFred;

std :: vector< intCharlie; < br $>
};

};

struct Test2 {

union {

std: :vector< intFred;

std :: vector< int>& Charlie = Fred;

};

};


这两个都不编译


Victor Bazarov < v。******** @ comAcast.netwrote in message

news:tf ********************* *********@comcast.com。 ..
struct Test {
union {
std::vector<intFred;
std::vector<intCharlie;
};
};
struct Test2 {
union {
std::vector<intFred;
std::vector<int>& Charlie = Fred;
};
};

Neither of these two compile

"Victor Bazarov" <v.********@comAcast.netwrote in message
news:tf******************************@comcast.com. ..

Peter Olcott写道:
Peter Olcott wrote:

>我试图引用相同的std: :矢量在一个类中由两个不同的名称,我尝试了一个联合,我尝试了一个参考,我似乎无法使语法正确。有人可以帮忙吗?谢谢
>I am trying to refer to the same std::vector in a class by two
different names, I tried a union, and I tried a reference, I can''t
seem to get the syntax right. Can anyone please help? Thanks



见常见问题5.8。


V

-

请在通过电子邮件回复时删除资金''A'

我没有回复最热门的回复,请不要问


See FAQ 5.8.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask



" Victor Bazarov" < v。******** @ comAcast.netwrote in message
"Victor Bazarov" <v.********@comAcast.netwrote in message

news:tf ************* *****************@comcast.com。 ..
news:tf******************************@comcast.com. ..

> Peter Olcott写道:
>Peter Olcott wrote:

>>我想参考同一个std :: vector在一个类中由两个不同的名字组成,我尝试了一个union,我尝试了一个引用,我似乎无法使语法正确。有人可以帮忙吗?谢谢
>>I am trying to refer to the same std::vector in a class by two
different names, I tried a union, and I tried a reference, I can''t
seem to get the syntax right. Can anyone please help? Thanks


请参阅常见问题5.8。

V
-
请在删除资金时删除资金'A'邮件
我没有回复最热门的回复,请不要问


See FAQ 5.8.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask



" Peter Olcott" < ol **** @ att.netwrote in message

news:XVwEg.772


"Peter Olcott" <ol****@att.netwrote in message
news:XVwEg.772


这篇关于std :: vector的别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆