c++ - 什么是规范地用来提及引用合并的词

标签 c++ reference

在 C++ 中,有一种机制可以在某些模板上下文和函数指针中“合并”引用。 void (*)() 等同于 void()

我一直在尝试用谷歌搜索它,但没有实际的术语是不可能的。

最佳答案

刚刚找到了!!它被称为引用折叠

比较https://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers

void f(int& && param);           // initial instantiation of f with lvalue

Because of the reference-to-reference, this instantiated code is prima facie invalid, but the source code– “f(x)” – is completely reasonable. To avoid rejecting it, C++11 performs “reference collapsing” when references to references arise in contexts such as template instantiation.

关于c++ - 什么是规范地用来提及引用合并的词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50056205/

相关文章:

c++ -/boost/lockfree/queue.hpp: 错误: 静态断言失败: (boost::has_trivial_destructor<T>::value)

c++ - 在 C++ 中使用::每次

c++ - 谷歌 v8 新失败在 linux 共享库引发 "segment error"

C#构造函数的方法引用

c++ - 外部类 : undefined reference when porting from gcc 3. x 到 4.x

c++ - 关于 C++ 中 ifstream 的 seekg() 函数的问题?

java - 如何在编程语言中生成一些长度固定为 r 的同分布伪随机 vector ?

java - 需要像指向 JTable (Java) 的指针之类的东西

swift - 初始化 AudioConverterRef Swift 3.0

python - 在没有exec/eval,python的字符串中调用代码