腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
搜索
关闭
文章
问答
(9999+)
视频
开发者手册
清单
用户
专栏
沙龙
全部问答
原创问答
Stack Exchange问答
更多筛选
回答情况:
全部
有回答
回答已采纳
提问时间:
不限
一周内
一月内
三月内
一年内
问题标签:
未找到与 相关的标签
筛选
重置
1
回答
是否在新的初始值设定项中使用
decltype
(
auto
)?
在C++
11
中,我可以很好地完成以下工作:但是在我尝试过的任何编译器中,以下这些都不起作用:
auto
a = new
decltype
(
auto
){42}; 如何在C++
11
的新初始化器中使用
decltype
(
auto
)?
浏览 0
提问于2015-03-01
得票数 0
5
回答
decltype
vs
auto
据我所知,
decltype
和
auto
都会尝试找出某种东西的类型。如果我们定义: return 34;那么这两个声明都是合法的:cout << x << endl; cout << y << endl; 你能告诉我
decltype
和
auto
的主要区别是什么吗?
浏览 4
修改于2016-02-21
得票数 63
回答已采纳
2
回答
C++模板自动返回类型与箭头符号需要解密类型?
C++
11
在函数中引入了返回类型的箭头符号(不知道名称):
auto
fun(T&& a) ->
decltype
(bar(a)){ ... } 但scott认为,使用
auto
作为返回类型本身将删除所有const和引用限定符(因为它遵循与模板演绎相同的模式),因此惯用的方法是执行
decltype
(
auto
),将所有限定符保持在类型的顶部。但是,在这种情况下,
auto
是否被推断为
decl
浏览 1
提问于2018-07-31
得票数 6
回答已采纳
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
回答
有没有任何方法来跟踪编译器的模板参数推断?
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
回答已采纳
3
回答
为什么解密看不见会员声明?
试图编译这个简单的类:struct M// interface// implementation std::vector<int> identities;导致错误: $ g++-510 where.cpp -std=c++
11
where.cpp:57:35: error: ‘struct M’ h
浏览 1
修改于2015-07-03
得票数 27
回答已采纳
2
回答
C++
11
中的
decltype
(
auto
) -推导返回类型
struct MyTypeB{ std::string _name;}; } return std::make_tuple(obj._id, obj._data)));上面是C++14,我可以用C++
11
重写类似的MakeObject代码,如下所示
浏览 0
修改于2017-01-13
得票数 2
1
回答
是否可以忽略c++
11
的后继返回类型特性,而更倾向于c++14的函数返回类型推断特性?
跳过表达式的返回类型时
auto
function(X x, Y y) ->
decltype
(x + y) return x + y;等于C++14中的下列代码
decltype
(
auto
) function(X x, Y y) return x + y;但是,在C++14中,可以不使用C++14规则推断返回类型。
auto
function() return 0;当我知道返回类型是什么的时候 C++<em
浏览 4
修改于2017-12-23
得票数 12
回答已采纳
3
回答
在C++
11
中使用
auto
和
decltype
我正在尝试学习目前被接受的c++
11
功能,但我在自动和解密方面遇到了麻烦。作为学习练习,我用一些泛型函数扩展了std类列表。map(const function<float (_Ty)>& f) -> FList<float>*
auto
temp = new FList<float>();for (
auto
i = begin(); i !
auto
map(const function<float (_Ty)>& f) -&
浏览 1
修改于2011-10-26
得票数 8
回答已采纳
3
回答
为什么在C++
11
中需要解密?
我正在学习
decltype
在C++
11
。template <typename T>{ // do stuff with val我
浏览 4
修改于2019-06-20
得票数 7
回答已采纳
1
回答
函数参数中容器的
Decltype
类型
我试图从函数的参数中扣除函数中stl容器的类型,但它不编译:
decltype
(v)::value_type b=0;}main.cpp:10:52: error: '
decltype
(v)' (aka 'constvector<double> &'
浏览 4
修改于2014-07-06
得票数 4
回答已采纳
3
回答
在成员函数尾部返回类型中使用这个和属性?
apply(F& f) ->
decltype
(f(_arg)) { }
auto
apply(F&0); }$ clang++ -std=c++
11
decltyp
浏览 3
修改于2017-05-23
得票数 6
回答已采纳
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
回答
解密类型需要实例化对象。
我对C++
11
标准做了一些实验,并提出了这个问题:#include <vector> class Container { std::vector<T> v;
auto
begin() ->
decltype
(v.begin()) {
浏览 3
修改于2012-03-18
得票数 3
回答已采纳
1
回答
C++:递归成员函数模板
> { } };
auto
Printer::print(const T &o) ->
decltype
(this->print(*o)) { print| template <typen
浏览 0
提问于2019-12-21
得票数 1
回答已采纳
1
回答
for循环初始化中的
auto
和
decltype
我一直在愉快地迭代,比如 i < n; ) { ...( int obj ) { i < n; ++i ) { }#endifvoid do_some( foo< int > obj ) { for(
auto</
浏览 0
修改于2012-08-21
得票数 4
1
回答
在模板参数的情况下,由解密型(
Auto
)推导出的参考非类型模板参数是否可以转发?
还有一个
decltype
(
auto
)模板-参数问题。这一次,我能够创建用于再现错误的最小代码如下所示:void foo(TT<V>) {struct Bar{};
浏览 2
提问于2017-09-20
得票数 9
1
回答
如何从自动返回类型中推断类型?
有如下代码片段:
auto
f(std::vector<T> v, F fun)
decltype
( bool( fun(v[0] ) ), void() )struct A { te
浏览 0
修改于2017-05-23
得票数 8
回答已采纳
2
回答
使用
auto
,
decltype
,=,[]声明函数
#include <iostream>{}; int
浏览 4
提问于2015-09-21
得票数 2
回答已采纳
5
回答
auto
与
decltype
的关系
是等同于或
decltype
((initializer)) x = initializer
浏览 0
修改于2015-08-15
得票数 35
回答已采纳
第 2 页
第 3 页
第 4 页
第 5 页
第 6 页
第 7 页
第 8 页
第 9 页
第 10 页
第 11 页
点击加载更多
领券