gpt4 book ai didi

c++ - 在函数头中使用 remove_reference

转载 作者:行者123 更新时间:2023-11-28 04:35:16 29 4
gpt4 key购买 nike

<分区>

假设我有以下内容:

template <typename... A>
class MyClass
{
public:

void func(A... args)
{
// do stuff
}
};

我真正想要的是让 func() 获取左值引用,所以像这样:

template <typename... A>
class MyClass
{
public:

void func(std::remove_reference<A>::type&... args)
{
// do stuff
}
};

这不会编译;这种事情可能吗?谢谢。

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