腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
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
回答
cv-限定符是否允许用于解密类型(
Auto
)变量?
标准规定: int main()
浏览 4
修改于2020-06-20
得票数 13
回答已采纳
1
回答
对于自动类型推导的参数,解密型(
Auto
)应该推导什么?
我认为这两个函数应该具有相同的返回类型:
decltype
(
auto
) f(T&& a){return a;}然而,使用gcc
7
,这些函数可以验证:static_assert(std::is_same<
decltype
(f(i)), int& >::value); static
浏览 1
修改于2017-04-20
得票数 3
回答已采纳
1
回答
在声明后将
decltype
与成员函数定义一起使用
我使用
decltype
作为成员函数的返回类型,但是定义和声明不匹配。下面是一些代码:struct A {
auto
f() ->
decltype
(x);
auto
A<T>::f() ->
decltype
(x) {} 这就产生了 test.cc:10:6: er
浏览 7
修改于2012-09-11
得票数 4
回答已采纳
3
回答
在成员函数尾部返回类型中使用这个和属性?
apply(F& f) ->
decltype
(f(_arg)) { }
auto
apply(F&
decltype
(f(_arg)) {test.cpp:8:
7
: error: '
auto
' return: invalid use of 'this
浏览 3
修改于2017-05-23
得票数 6
回答已采纳
2
回答
使用
auto
,
decltype
,=,[]声明函数
#include <iostream>{}; int
浏览 4
提问于2015-09-21
得票数 2
回答已采纳
5
回答
auto
与
decltype
的关系
是等同于或
decltype
((initializer)) x = initializer
浏览 0
修改于2015-08-15
得票数 35
回答已采纳
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
2
回答
函数模板参数和带'
auto
‘的函数参数有什么区别?
(arg1)>) arg1.non_existent_member =
7
; { }我想知道的是,如果归结为编写一个函数,如果我这样写,会有什么不同:void likeThis(Arg arg){}void o
浏览 4
提问于2021-05-27
得票数 4
3
回答
使用函数参数作为常量表达式的一部分- gcc对clang
f(T t) ->
decltype
(B<pred(t)>{})} src:
7
:34:错误:模板参数1无效自动f( t ) ->解密类型(B<pred(T)>{})^ src:
7
:34:错误:模板参数1无效src:
7
:25:错误:无效模板-id
auto
( t) ->解密类型(B<pred( t) >{})^src:
7
:36:错误:类模板参数推
浏览 1
提问于2018-05-24
得票数 24
回答已采纳
1
回答
有没有任何方法来跟踪编译器的模板参数推断?
auto
) foo(T&& t) ->
decltype
(t + t) return t + t;
decltype
(
auto
) foo(T&->
decltype
(t * t): seems valid candidate:
decltype
(
auto
) foo(T&& t) ->
decltype
(t.size()):
浏览 1
修改于2018-02-16
得票数 8
回答已采纳
1
回答
后继返回类型中的占位符是否覆盖初始占位符?
g++似乎接受
auto
和
decltype
(
auto
)的任何组合作为初始和尾部返回类型:
auto
f() { return (a); }// int
auto
h() ->
decltype
(
auto
) { return(a); }
浏览 1
修改于2014-08-20
得票数 6
回答已采纳
3
回答
C++模板-参数依赖于ABI错误名称的解密类型
考虑以下职能:
auto
Min(A&& a, B&& b) ->
decltype
(a < b ?奇怪的是,Min ( g++ )和clang (我的代码)的错误名称是_Z3MinIiiEDTqultfp_fp0_cl
7
forwardIT_Efp_Ecl
7
forwardIT0_Efp0_EEOS0_OS1_ (又名:
decltype
(({parm#1}<{p
浏览 8
修改于2012-11-08
得票数 15
回答已采纳
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
回答
是否在新的初始值设定项中使用
decltype
(
auto
)?
在C++11中,我可以很好地完成以下工作:但是在我尝试过的任何编译器中,以下这些都不起作用:
auto
a = new
decltype
(
auto
){42}; 如何在C++11的新初始化器中使用
decltype
(
auto
)?
浏览 0
提问于2015-03-01
得票数 0
2
回答
C++模板自动返回类型与箭头符号需要解密类型?
C++11在函数中引入了返回类型的箭头符号(不知道名称):
auto
fun(T&& a) ->
decltype
(bar(a)){ ... } 但scott认为,使用
auto
作为返回类型本身将删除所有const和引用限定符(因为它遵循与模板演绎相同的模式),因此惯用的方法是执行
decltype
(
auto
),将所有限定符保持在类型的顶部。但是,在这种情况下,
auto
是否被推断为
decltype
浏览 1
提问于2018-07-31
得票数 6
回答已采纳
2
回答
与lambda尾随返回类型不一致
考虑使用gcc-7.0.0最新快照的代码:
auto
lambda2= [](
auto
&& id) ->
decltype
(
auto
) { return id == 10; }; static_assert(!std::experimental::is_detected_v
浏览 3
修改于2016-11-02
得票数 2
回答已采纳
1
回答
泛型重载运算符
实际上,由于c++14 et可以做到这一点: return v1 + v2;但是,我想尝试使用模板化的类,这些类包含像下面这样的值就像这个: return t1.value + t2.value;PS:在这里,您的测试代码使用gcc<e
浏览 4
提问于2016-12-13
得票数 2
回答已采纳
2
回答
为什么{1,2}没有类型,但解密类型(A)是格式良好的?
所以我预计像
auto
a = {1, 2};这样的东西是畸形的。但这根本不是真的。#include <iostream> 此外,
decltype</em
浏览 0
提问于2014-11-29
得票数 2
回答已采纳
1
回答
从C++ lambda返回类型
我有兴趣了解尾随
auto
&&返回类型的确切含义,特别是区别于这里不工作的
decltype
(
auto
),以及未指定的返回类型,后者也不起作用。 struct Foo { int x_; };
浏览 2
修改于2020-05-12
得票数 3
回答已采纳
第 2 页
第 3 页
第 4 页
第 5 页
第 6 页
第 7 页
第 8 页
第 9 页
第 10 页
第 11 页
点击加载更多
领券