在 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/