腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
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
回答
C++14自动推导错误:函数返回数组
我试图应用新的C++14特性,但在尝试将const char[]参数传递给以下函数时意外地遇到了错误: {/untitled
6
/main.cpp: In instantiation of '<lambda(const
auto
:3&)> [with
auto
:3 = char [15]]': ../../untitle
浏览 1
修改于2015-02-07
得票数 1
回答已采纳
2
回答
默认模板参数&未评估上下文中的lambda : bug还是功能?
std::is_same_v<
decltype
(x0),
decltype
(y0)>; constexpr
auto
x1 = function();constexpr
auto
x4 = ctad(); constexpr
auto</e
浏览 0
修改于2019-04-02
得票数 39
回答已采纳
2
回答
与解密和自动的原型失配
^};
auto
MyClass<T>::getId() ->
decltype
(MyClass<T>::_id) return _id;错误: test.cpp:10:
浏览 8
修改于2016-05-12
得票数 14
回答已采纳
3
回答
编译器不能推断返回类型吗?
我试图在一个自动函数上使用
decltype
关键字: static
auto
foo() { }
decltype
(foo());我得到了以下错误(gcc 7.4): <source>:
6
:25: error: use of 'static
auto
Thing::foo()' before deduction of '
auto<
浏览 1
提问于2018-03-13
得票数 12
回答已采纳
1
回答
在声明后将
decltype
与成员函数定义一起使用
我使用
decltype
作为成员函数的返回类型,但是定义和声明不匹配。下面是一些代码:struct A {
auto
f() ->
decltype
(x);
auto
A<T>::f() ->
decltype
(x) {} 这就产生了 test.cc:10:
6
浏览 7
修改于2012-09-11
得票数 4
回答已采纳
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
1
回答
在模板参数的情况下,由解密型(
Auto
)推导出的参考非类型模板参数是否可以转发?
还有一个
decltype
(
auto
)模板-参数问题。这一次,我能够创建用于再现错误的最小代码如下所示:void foo(TT<V>) {struct Bar{};
浏览 2
提问于2017-09-20
得票数 9
1
回答
如何在clang中使用解密类型(*this)
如果我不评论// typedef
auto
getFoo1() ->
decltype
(*this);,这个程序可以在gcc身上运行,但是它在clang ()上编译失败。class Foo { // typedef
auto
getFoo1() ->
decltype
(*this);
auto
getFoo2() -&
浏览 10
修改于2022-08-23
得票数 1
回答已采纳
2
回答
将
decltype
与带有尾随返回类型语法的模板化成员函数一起使用时,存在编译错误,但不存在clang
eval(const T& in) ->
decltype
(in(val[0]));
auto
point::eval(const T& in) ->pt.eval(f) << std::endl;这段代码在clang++和g++-5中可以正常编译和工作,但在g++-
6
中会出现以下错误。> g++-
6
main.cpp -o test -std=c++11 -Wall main.cpp:13:
6</em
浏览 13
修改于2017-01-18
得票数 1
回答已采纳
1
回答
使用`std::enable_if`失败的转发包装器
is_same<
decltype
(func(args...)), void>,
decltype
(func(args...))is_same<
decltype
(func(args...)), void>,
decltype
(func(args...))time_function(int (*)(int), int)'^ <source>:20
浏览 8
修改于2019-11-03
得票数 2
回答已采纳
1
回答
C++:递归成员函数模板
> { } };
auto
Printer::print(const T &o) ->
decltype
(this->print(*o)) { print::make_optional(std::m
浏览 0
提问于2019-12-21
得票数 1
回答已采纳
1
回答
后继返回类型中的占位符是否覆盖初始占位符?
g++似乎接受
auto
和
decltype
(
auto
)的任何组合作为初始和尾部返回类型:
auto
f() { return (a); }// int
auto
h() ->
decltype
(
auto
) { return(a); }
浏览 1
修改于2014-08-20
得票数 6
回答已采纳
2
回答
函数模板中定义的lambda闭包类型可以说是什么?
return [=](T x) { return x * y; }; {
auto
f2 = foo<int>(
6
.); // fails with
auto
f2 = foo<double>(
6
.); static_assert(std::is_same_v<
decltype
(f1),
decltype
(f2)>
浏览 0
修改于2019-09-05
得票数 3
回答已采纳
1
回答
解密(Std)是合法的,它有什么目的吗?
当在命名空间中使用
decltype
时,我可以编写编译代码,但是语句在g++4.9.1下似乎没有任何效果,而在clang下则生成error: unexpected namespace name 'std'using s =
decltype
(std);
auto
sz = n.size(); //
浏览 3
修改于2014-09-30
得票数 9
回答已采纳
3
回答
c++:将向量转换为元组
T { };vector<T*> tv; tv.push_back(new T());我想要得到 ConvConnection<
decltype
(*C1[0]), arma
浏览 0
修改于2015-02-09
得票数 11
1
回答
为什么我没有得到匹配的函数调用错误?
‘int main()’中:prog.cpp:16:19:注意:候选人是:prog.cpp:4:
6
:注意:模板参数演绎/替换失败: prog.cpp:代替‘template<class A, class B>
decltype
*(declval<B>)()) foo(A&am
浏览 1
修改于2013-05-05
得票数 2
回答已采纳
1
回答
C++17 allocator_traits实现
allocator_traits.hpp,因为<memory>太全面了:#include
aut
浏览 0
修改于2019-05-13
得票数 5
回答已采纳
第 2 页
第 3 页
第 4 页
第 5 页
第 6 页
第 7 页
第 8 页
第 9 页
第 10 页
第 11 页
点击加载更多
领券