腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
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
回答已采纳
2
回答
默认模板参数&未评估上下文中的lambda : bug还是功能?
std::is_same_v<
decltype
(x0),
decltype
(y0)>; constexpr
auto
x1 = function();constexpr
auto
x2 = defaulted(); constexprst
浏览 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
1
回答
为什么gcc和clang在聚合初始化方面给出了不同的结果?
f(X<
4
>) ->
decltype
(T(U{}, U{}, U{}, U{}), 0u) { return
4
u; } constexpr
auto
f(X<3>) ->
decltype
(T(U{}, U{}, U{}), 0u) { return 3u; } constexpr
auto
f(X<2>) ->
浏览 7
修改于2021-12-29
得票数 1
回答已采纳
1
回答
为什么我不能在range-for的多维数组中使用
decltype
?
我尝试在range-for循环中使用
decltype
来使用多维数组: {0, 1, 2, 3 }, {8, 9, 10, 11} cout<< "{"; for (
auto
浏览 0
提问于2019-02-23
得票数 0
2
回答
使用
auto
,
decltype
,=,[]声明函数
#include <iostream>{}; int
浏览 4
提问于2015-09-21
得票数 2
回答已采纳
5
回答
auto
与
decltype
的关系
是等同于或
decltype
((initializer)) x = initializer
浏览 0
修改于2015-08-15
得票数 35
回答已采纳
3
回答
完美转发
struct B{} int data_array[100];{ const A x_const;
auto
y2 = f(x);
auto
y
4
= f(std::move(x));我想知道一个f (最好是函数,但宏也可以),这样:<e
浏览 0
修改于2012-02-10
得票数 5
1
回答
循环遍历异构类型的变量
template <typename ...A>{ (f(std::forward<
decltype
(a)>(a)),
auto
cond_loop(A&& ...a) noexcept return [&](
auto
const f) noe
浏览 0
提问于2021-08-05
得票数 2
2
回答
如何在C++14中编写通用转发lambda?
尝试#1在函数体中,x是一个lvalue,所以这是不起作用的。尝试#2这正确地转发了lambda中的引用,但是它总是按值返回(除非编译器删除副本)。尝试#3 [](
auto
&& x) ->
decltype
(x) { return std::forward<
dec
浏览 1
提问于2015-05-07
得票数 16
回答已采纳
1
回答
不同引用限定符运算符重载结果的类型特征
<class X>(A)
4
4
4
4
4
4<
浏览 2
提问于2014-05-01
得票数 4
2
回答
Lambda捕获意外变量。
pair<
decltype
(increase),
decltype
(print) > return p ;
auto
lambdas = func() ;
auto
print = lambdas.second( print ) ).name() << '\n
浏览 4
修改于2016-05-16
得票数 0
回答已采纳
1
回答
后继返回类型中的占位符是否覆盖初始占位符?
g++似乎接受
auto
和
decltype
(
auto
)的任何组合作为初始和尾部返回类型:
auto
f() { return (a); }// int
auto
h() ->
decltype
(
auto
) { return(a); }
浏览 1
修改于2014-08-20
得票数 6
回答已采纳
1
回答
如何推断自动指针所指向的类型?
在这种情况下,我很难找到如何使用
decltype
()。include "boost/multi_array.hpp" boost::multi_array<double, 3> A(boost::extents[5][
4
][2]); boost::array<
decltype
(*dims), 3> dims3; // does not compil
浏览 1
提问于2014-05-17
得票数 0
回答已采纳
1
回答
使用
decltype
选择函数专门化
我想知道为什么在我的示例中不能使用
decltype
说明符来选择特定的模板方法。sum = sumBytes(str,2,3,
4
);
auto
sum(const T& value)
auto
sumBytes(const First& first,
浏览 10
提问于2019-05-12
得票数 3
回答已采纳
1
回答
如何在c++1y中保留返回类型推导中的cv限定符或引用?
但是随着c++14中正常返回类型演绎的到来,我猜我可以跳过后面的部分,但只有在使用
auto
时,返回类型才会像普通的
auto
一样忽略限定符和引用。std::cout << std::boolalpha; B<A2> b2; B<A
4
> b
4
; static_assert(std::is_same<<e
浏览 1
修改于2013-05-30
得票数 5
回答已采纳
3
回答
将
decltype
和std::function与lambda一起使用
auto
x =
4
;x_t y = 5;
auto
func = [&] (int i) { cout << "Hello: i=" << i << " j=" << j << endl;}; typedef
decltype
浏览 0
提问于2012-11-30
得票数 10
回答已采纳
1
回答
是否可以定义一个包含函数和lambda的可调用概念?
::is_function_v<std::remove_pointer_t<std::decay_t<F>>> || (requires (F f) {}); return true;} 然而,如果我定义这
浏览 3
修改于2020-05-07
得票数 1
第 2 页
第 3 页
第 4 页
第 5 页
第 6 页
第 7 页
第 8 页
第 9 页
第 10 页
第 11 页
点击加载更多
领券