gpt4 book ai didi

c++ - C++ 模板中变量后面的 "&"是什么?

转载 作者:搜寻专家 更新时间:2023-10-31 01:58:05 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
What does “Class* &cls” mean in C++'s function definition?

我遇到了这段代码:

template <class T,class U> void inline TIntDataSwap2(U data,T i)
{
unsigned char*& data2=(unsigned char*&)data;
data2[0]=(unsigned char)(((unsigned int)i>> 8)&0xff);
data2[1]=(unsigned char)(((unsigned int)i>> 0)&0xff);
};

unsigned char *后面的“&”是什么意思?

只能在模板中使用吗?我以前从未见过它,“& behind a variable”很难用谷歌搜索,请帮助我...

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com