-> 在函数签名中的 c++11 中是什么意思?
What does -> mean in c++11 in a function signature?
请注意,这不是什么副本 - >平均C ?
这个问题特定于C 11;函数看起来像:
struct string_accumulator {
}
inline auto collect() -> string_accumulator
{
return string_accumulator();
}
在这种情况下, ->是什么含义?
它是尾随返回类型。它可用于明确指定 lambda表达式的返回类型或指定取决于函数捕获的返回类型。示例:
[](int) -> float { return 0.f; };
template <typename A, typename B>
auto foo(A a, B b) -> decltype(a + b) { return a + b; }
相关文章:
- "类模板示例<int>;"语句对 C++11 是什么意思?
- 无法访问的代码 在 C++11 中,可能导致这种情况的原因是什么?
- C 11中的标准方法是什么,可以访问std :: vector中元素n的指针
- 在 C++11 中表示日内时间 HH:MM:SS 的最佳方法是什么?
- C 11中成员函数的值类别属性是什么?
- C++11 中的默认正则表达式引擎是什么?
- 在 C++11 中获取当前时间的最快方法是什么
- -> 在函数签名中的 c++11 中是什么意思?
- C 11-将变量初始化为参考是什么意思
- 在C#WPF应用程序中使用C++11库的选项是什么
- 缩小 C++11 中的转换范围:"actual value after conversion"是什么?
- 在C 11中具有哈希地图结构的最直接侵略是什么
- 要实现的最简单 C++11 容器是什么?
- 在 C++11 中,获取系统即时报价/时间的最快方法是什么?
- 在C++11类型推理过程中,控制优先级的规则是什么
- 在C++11中,推荐的对齐内存的方法是什么
- C++11标准中的核心常量表达式是什么
- 在没有c++11的情况下,擦除映射中最后插入的元素的正确方法是什么
- C++11 中的thread_local是什么意思
- C++11 中的"auto var = {condition} ? 1 : 1.0"是什么类型?是双精度还是整数?