gpt4 book ai didi

c++ - 关于数组大小计算

转载 作者:太空狗 更新时间:2023-10-29 20:00:46 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Can someone explain this template code that gives me the size of an array?

您好,我正在查看此处发布的答案:

Computing length of array

复制在这里:

template <typename T, std::size_t N>
std::size_t size(T (&)[N])
{
return N;
}

有人能解释一下 (&) 的意义吗?

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