腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
搜索
关闭
文章
问答
(9999+)
视频
开发者手册
清单
用户
专栏
沙龙
全部问答
原创问答
Stack Exchange问答
更多筛选
回答情况:
全部
有回答
回答已采纳
提问时间:
不限
一周内
一月内
三月内
一年内
问题标签:
未找到与 相关的标签
筛选
重置
5
回答
decltype
vs
auto
据我所知,
decltype
和
auto
都会尝试找出某种东西的类型。如果我们定义: return 34;那么这两个声明都是合法的:cout << x << endl; cout << y << endl; 你能告诉我
decltype
和
auto
的主要区别是什么吗?
浏览 4
修改于2016-02-21
得票数 63
回答已采纳
2
回答
与lambda尾随返回类型不一致
考虑使用gcc-7.0.0最新快照的代码:
auto
lambda
2
= [](
auto
&& id) ->
decltype
(
auto
) { return id == 10; }; static_assert(!std::experimental::is_d
浏览 3
修改于2016-11-02
得票数 2
回答已采纳
1
回答
检测模板化操作符()的限定符
这意味着std::bind表达式(不使用std::is_bind_expression)和带有
auto
参数的lambda。预期的返回类型和参数是已知的。例如:struct is_templated_functor { ... }; is_templated_functor<void(int),
decltype
(fu
浏览 3
修改于2015-09-11
得票数 0
回答已采纳
2
回答
使用
auto
,
decltype
,=,[]声明函数
#include <iostream>{}; intf = [](int a, int b) //DOES NOT WORK return a * b;*/ { int a =
2
, b = 3;
浏览 4
提问于2015-09-21
得票数 2
回答已采纳
1
回答
使用
decltype
和
auto
推导const (return)类型
()
decltype
(
auto
) i = func(); // i is of type 'int', similar to
auto
i = func()
decltype
(
auto
) iA = funcAuto(); // iA is of type 'int', similar to
auto
iA = fu
浏览 49
提问于2018-06-06
得票数 0
回答已采纳
5
回答
auto
与
decltype
的关系
是等同于或
decltype
((initializer)) x = initializer
浏览 0
修改于2015-08-15
得票数 35
回答已采纳
2
回答
为什么std::向前不工作在羔羊身上?
#include <utility> {
auto
fn
2
= std::forward<
decltype
(fn1)>(fn1); fn3(); [fn<em
浏览 5
修改于2021-12-03
得票数 3
回答已采纳
1
回答
decltype
(
auto
)函数返回类型不会推导出&&类型
如果一个函数返回
decltype
(
auto
),并且它返回一个int&&类型的局部变量,为什么返回类型是int&?如果我将变量转换为它自己的类型,那么返回类型就是我所期望的(int&&) #include <utility>
auto
i = 5; int&& ret = std::move(i);
浏览 17
提问于2019-05-07
得票数 5
1
回答
从C++ lambda返回类型
我有兴趣了解尾随
auto
&&返回类型的确切含义,特别是区别于这里不工作的
decltype
(
auto
),以及未指定的返回类型,后者也不起作用。 在下面的代码中,fn返回参数的x_字段。我明白为什么->
auto
会导致这种情况,但我希望->
decltype
(
auto
)返回int&。为什么只有->
auto
&&才能工作?(
auto
) { return std::forward<
decl
浏览 2
修改于2020-05-12
得票数 3
回答已采纳
2
回答
默认模板参数&未评估上下文中的lambda : bug还是功能?
std::is_same_v<
decltype
(x0),
decltype
(y0)>; constexpr
auto
x1 = function();constexpr
auto
x
2
= defaulted(); co
浏览 0
修改于2019-04-02
得票数 39
回答已采纳
2
回答
为什么
auto
会有不同的推导?
int main(){
auto
x
2
= x; static_assert(is_same<int,
decltype
(x
2
)>::value, "
declty
浏览 2
修改于2013-05-22
得票数 11
回答已采纳
1
回答
为什么C++20的概念与"const &“不兼容?
template<typename T>Octet
decltype
(
auto
) c = 'a'; voidf1(const
auto
&) {} void f
2
(Octet
auto
) {} void f3(Octet
auto
&&)
浏览 6
修改于2021-05-07
得票数 6
回答已采纳
1
回答
泛型lambda尾随返回类型中的函数作用域名称无法编译(MSVC)
给定以下代码片段,case 1、
2
、3和4在Visual Studio2017 (/std:c++14)中编译,但case 5没有。这是怎么回事?int i; int j;
auto
ca
浏览 10
修改于2018-11-20
得票数 0
1
回答
将约束的自动占位符混合为非尾随返回类型和显式尾部返回类型。
template<class T>C
auto
g
2
(
auto
) -> char { return '
2
'; } return g1(0) + g
2
(0); GCC & MSVC:好,返回1 + '
2</
浏览 3
修改于2022-04-17
得票数 0
1
回答
可变模板重载解析
TAIL> return List<
decltype
(HEAD::increment()),TAIL...>();它确实在起作用:
auto
l0 = incrFront<Counter<0>>(); // Ok,
decltype
(l0) ==
浏览 2
修改于2013-05-21
得票数 1
回答已采纳
1
回答
后继返回类型中的占位符是否覆盖初始占位符?
g++似乎接受
auto
和
decltype
(
auto
)的任何组合作为初始和尾部返回类型:
auto
f() { return (a); }// int
auto
h() ->
decltype
(
auto
) { return(a); }
浏览 1
修改于2014-08-20
得票数 6
回答已采纳
3
回答
计算lambda中的参数数。
auto
lambda0 = [&]() { ... };
auto
lambda
2
= [&](int32_t a,
auto
b) { ... }; lambda_details<
decltype
(lam
浏览 0
修改于2019-01-27
得票数 14
回答已采纳
1
回答
函数返回的C++类型lambda闭包
考虑以下示例代码:{ { };
auto
f1 = id();
auto
g1 = id();std::cout<<std::is_same<
decltype<
浏览 4
修改于2017-05-23
得票数 4
回答已采纳
4
回答
auto
在C++17模板参数中的优势
auto
在C++17引入的模板参数中有哪些优点(可能)?
auto
v
2
= constant<true>; // v
2
== true,
decltype
(v
2
) is bool
a
浏览 11
修改于2017-03-16
得票数 70
回答已采纳
2
回答
C++14自动推导错误:函数返回数组
我试图应用新的C++14特性,但在尝试将const char[]参数传递给以下函数时意外地遇到了错误: {lambd = [](const
auto
& word){ autofunc(std::forward<
decltype
(word) > (word));};/untitled6/main.cpp:60:17: note: template<class
浏览 1
修改于2015-02-07
得票数 1
回答已采纳
第 2 页
第 3 页
第 4 页
第 5 页
第 6 页
第 7 页
第 8 页
第 9 页
第 10 页
第 11 页
点击加载更多
领券