腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
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
回答已采纳
1
回答
为什么C++20的概念与"const &“不兼容?
template<typename T>Octet
decltype
(
auto
) c = 'a'; voidf1(const
auto
&) {} void f2(Octet
auto
) {} void f3(Octet
auto
&&) {}
浏览 6
修改于2021-05-07
得票数 6
回答已采纳
1
回答
decltype
(
auto
)函数返回类型不会推导出&&类型
如果一个函数返回
decltype
(
auto
),并且它返回一个int&&类型的局部变量,为什么返回类型是int&?如果我将变量转换为它自己的类型,那么返回类型就是我所期望的(int&&) #include <utility>
auto
i =
5
; int&& re
浏览 17
提问于2019-05-07
得票数 5
2
回答
默认模板参数&未评估上下文中的lambda : bug还是功能?
std::is_same_v<
decltype
(x0),
decltype
(y0)>; constexpr
auto
x1 = function();constexpr
auto
x3 = object(); constexpr
aut
浏览 0
修改于2019-04-02
得票数 39
回答已采纳
2
回答
为什么std::向前不工作在羔羊身上?
#include <utility> {
auto
fn2 = std::forward<
decltype
(fn1)>(fn1); fn3(); [fn2 = std::forward<
declty
浏览 5
修改于2021-12-03
得票数 3
回答已采纳
1
回答
泛型lambda尾随返回类型中的函数作用域名称无法编译(MSVC)
给定以下代码片段,case 1、2、3和4在Visual Studio2017 (/std:c++14)中编译,但case
5
没有。这是怎么回事?int i; int j;
auto
case3 = [j]
浏览 10
修改于2018-11-20
得票数 0
4
回答
auto
在C++17模板参数中的优势
auto
在C++17引入的模板参数中有哪些优点(可能)?
auto
v2 = constant<true>; // v2 == true,
decltype
(v2) is bool
auto
浏览 11
修改于2017-03-16
得票数 70
回答已采纳
2
回答
使用
auto
,
decltype
,=,[]声明函数
#include <iostream>{}; int
浏览 4
提问于2015-09-21
得票数 2
回答已采纳
5
回答
auto
与
decltype
的关系
是等同于或
decltype
((initializer)) x = initializer
浏览 0
修改于2015-08-15
得票数 35
回答已采纳
1
回答
C++17模板演绎指南不用于空参数集?
a = success{
5
}; // works
auto
c = success{"hello"}; // works
auto
e = success(); /
浏览 4
修改于2017-07-19
得票数 4
回答已采纳
1
回答
为什么“返回(str);”推断出与C++中的“返回str;”不同的类型?
案例1:{ return str
decltype
(
auto
)是str的一种类型。案例2:{
浏览 2
修改于2019-11-30
得票数 13
回答已采纳
1
回答
为什么我不能在range-for的多维数组中使用
decltype
?
我尝试在range-for循环中使用
decltype
来使用多维数组: {0, 1, 2, 3 }, {8, 9, 10, 11} cout<< "{"; for (
auto
col : ro
浏览 0
提问于2019-02-23
得票数 0
1
回答
后继返回类型中的占位符是否覆盖初始占位符?
g++似乎接受
auto
和
decltype
(
auto
)的任何组合作为初始和尾部返回类型:
auto
f() { return (a); }// int
auto
h() ->
decltype
(
auto
) { return(a); }
浏览 1
修改于2014-08-20
得票数 6
回答已采纳
1
回答
在模板参数的情况下,由解密型(
Auto
)推导出的参考非类型模板参数是否可以转发?
还有一个
decltype
(
auto
)模板-参数问题。这一次,我能够创建用于再现错误的最小代码如下所示:void foo(TT<V>) {struct Bar{};
浏览 2
提问于2017-09-20
得票数 9
1
回答
如何推断自动指针所指向的类型?
在这种情况下,我很难找到如何使用
decltype
()。: boost::multi_array<double, 3> A(boost::extents[
5
][4][2]); boost::array<
decltype
(*dims), 3> dims3; // does not com
浏览 1
提问于2014-05-17
得票数 0
回答已采纳
1
回答
利用lambda实现pair.second的完美转发
get_second = [](
auto
&& pair) constexpr noexcept ->
decltype
(
auto
) std::unordered_map<unsigned, std::pair<double, char> > m = {{
5
, {0., '
浏览 1
提问于2020-09-03
得票数 2
回答已采纳
1
回答
泛型重载运算符
实际上,由于c++14 et可以做到这一点: return v1 + v2;但是,我想尝试使用模板化的类,这些类包含像下面这样的值就像这个: return t1.value + t2.value;} template<typen
浏览 4
提问于2016-12-13
得票数 2
回答已采纳
1
回答
朋友缩写模板函数- clang和gcc不同
add(
auto
a,
auto
b); // the
decltype
(a) is needed to make clang happy// see: https://stackoverflow.com/questions/62779242 return number<
decltype
(a)>{a}.
浏览 5
提问于2020-07-07
得票数 5
回答已采纳
1
回答
C++17中
(std::is_void<
decltype
(wrapped(std::forward<
decltype
(args)>(args)...))//
auto
result = wrapped(std::forward<
decltype
(args)>(args)...);
decltype
(wrapped(std::forward
auto
endTimePoint = std::chrono::high_resolut
浏览 0
修改于2019-02-14
得票数 3
回答已采纳
1
回答
当requires子句失败时,函数尾部返回类型是否评估?
当SFINAE在clang、gcc和Visual中失败时,不计算尾随返回类型
decltype
(foo(t)) of baz(T t)。}template<typename T> requires std::is_integral<T>::value
auto
baz(T t) ->
decltype
浏览 4
提问于2022-05-31
得票数 5
回答已采纳
第 2 页
第 3 页
第 4 页
第 5 页
第 6 页
第 7 页
第 8 页
第 9 页
第 10 页
第 11 页
点击加载更多
领券