腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
3
回答
将
decay
与
完美
转发
结合
使用
、
、
、
、
1, 2, 3 };{callDecayExample2(j); // deduced as int& 尽管两个函数中的推导相似,但在第二个函数中,我必须
使用
std::
decay</e
浏览 7
提问于2019-12-20
得票数 1
回答已采纳
2
回答
将
std::
decay
与
std::forward
结合
使用
、
、
、
typename T>{ T value; template<typename U> template<typename U =
decay
<T>, typename US =
decay
<std::string& _value, US&& _key)
浏览 41
提问于2020-10-15
得票数 3
回答已采纳
3
回答
线程构造函数如何检测rvalue引用?
、
、
、
、
显然,可以
将
rvalue引用传递给std::thread构造函数。我的问题是在中定义这个构造函数。它说这个构造函数:explicit thread( Function&& f, Args&&... args );
浏览 4
提问于2016-05-15
得票数 4
回答已采纳
1
回答
用于
完美
转发
的模板
与
任意value_type的Tempate组合
、
、
、
、
value,int> = 0> void (ContainerType const& list) { /* */ } 模板<typename ContainerType,std::enable_if_t<std::is_same<std::
decay
_t,std::vector>:copy-semantics
浏览 0
提问于2016-03-10
得票数 1
回答已采纳
1
回答
为什么“std::异步”不能像预期的那样工作呢?
、
、
、
#include <thread>#include <utility> void Async(Callable&& fn, Args&&... args) auto fn_wrapper = [](Callable&& fn, Args&&... args) in
浏览 3
提问于2017-02-10
得票数 6
回答已采纳
1
回答
C++11线程包装函数
、
thread_wrapper<F,Args...>, std::forward<F>(f), std::forward<Args>(args)...);这样,线程管理器就应该生成一个
使用
包装器函数的线程但是编译器现在说:试图
使用
已删除的函数.。template <class _Fp, class ..._Args, size_t ...编辑void foo(int i) { std::cout << "foo: &qu
浏览 1
提问于2015-10-25
得票数 1
回答已采纳
2
回答
正确
使用
通用引用
、
、
、
、
/ do stuff doThingsWithB(b); // do stuff但是现在,
使用
移动语义,允许我的函数
将
rvalue引用作为参数并添加这些重载可能会变得有趣(至少在某些情况下是这样):void doThingsWithB(B&& b);从我收集到的信
浏览 2
提问于2014-06-19
得票数 7
回答已采纳
3
回答
std::forward<std::
decay
_t<F>>(f)的含义
、
、
、
、
当我传递左值引用时,我有一个关于用编写的代码的问题,如果我不用std::
decay
_t删除引用,我会得到一个错误。<typename F>makeFixPoint(F&& f) noexcept return FixPoint<std::
decay
_t<F>>{std::forward<std::
decay
_t<F>>(f)};} // namespace in
浏览 6
提问于2022-03-09
得票数 0
回答已采纳
2
回答
visual实现“移动语义”和"rvalue引用“
、
、
、
、
但是,
使用
Visual 2012我得到了这段代码的编译错误。编译器抱怨toSin(list<double>&&)的参数类型。如果我
将
参数类型更改为list<double>&,则编译代码。
浏览 1
提问于2015-02-04
得票数 5
2
回答
什么是
完美
的
转发
等于
、
、
、
、
我知道这可以用来执行
完美
的
转发
:void foo(A&&) { /* */ }template <typenameA, std::enable_if_t<std::is_same<std::
decay
_t<A>, int>::value, int> = 0> void foo(A&&) { /* *&
浏览 3
提问于2016-03-16
得票数 0
回答已采纳
2
回答
标准布局元组实现
、
它主要基于Nish的实施,但我
使用
嵌套成员的递归层次结构,而不是递归继承。不幸的是,这种方法需要递归来进行元素访问。Ts> { struct tuple_builder<T> static inline void make (tuple<typename :
浏览 0
提问于2014-06-02
得票数 9
回答已采纳
3
回答
用std::enable_if保护复制构造函数
、
、
、
、
我想我可以防止构造函数在Runnable == Envelope
与
std::enable_if类似的情况下被调用} 它编译得很好(虽然它在Visual 2015中触发了一些intellisense错误,这有点烦人),但它不能阻止
使用
非
浏览 4
提问于2017-05-12
得票数 4
回答已采纳
1
回答
使用
混叠限制对单个类型的通用引用
、
、
、
我有一个类的成员函数,其中我想对其中一个参数
使用
完美
转发
。但是,被
转发
到的函数只接受c2Type类型的单个参数,因此我希望调用函数也只接受c2Type参数,但显然必须保留通用引用才能进行
转发
。它似乎可以
使用
默认模板参数来完成,如下所示:{}; template<typename T, typenameisC2Type = typename std::enable_if<
浏览 3
提问于2015-01-05
得票数 1
回答已采纳
2
回答
在
完美
转发
中需要衰减
、
template<typename T> funka( std::forward<std::
decay
_t<T>>( v ) );所以问题是。
浏览 0
提问于2018-08-27
得票数 3
2
回答
如何
使用
std::enable_if_t
与
完美
的
转发
?
、
、
、
、
function for call to 'foo(const std::pair<int, int>&, std::pair<int, int>, std::pair<int, int>)' 如何
将
std
浏览 17
提问于2020-02-23
得票数 2
回答已采纳
1
回答
从均匀分布的N个元素中随机选择C++模板
、
、
我
使用
模板实现了这一点:const T& chooseImpl(T const& cur, int total) {} template
浏览 0
提问于2016-06-05
得票数 4
回答已采纳
2
回答
如何编写具有并行执行策略的C++17算法
、
、
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ });那么,我从根本上误解了如何
使用
如果没有,如何检查执行策略并正确
使用</e
浏览 0
提问于2019-09-01
得票数 1
回答已采纳
2
回答
基类型为函数引用时的Rvalue引用重载
、
我有一个类似于此的类,它应该接受一个函数对象并在以后
使用
它:class A { A(const F& f) : _f(f) {}我得到一个错误,当我调用A<F>::A(F&&)时,不可能用A<F>::A(const F&)重载F = void(&)():我知道我可以通过
使用
函数指针而不是函数引用来修复它
浏览 3
提问于2014-07-03
得票数 3
回答已采纳
1
回答
当存在模板构造函数时,编译器为什么要生成一个复制/移动构造函数?
、
那么,为什么
与
复制构造函数具有相同签名的模板构造函数不简单地命名为复制构造函数?
浏览 5
提问于2017-03-01
得票数 4
回答已采纳
5
回答
使用
模板进行C++重载解析
、
、
、
我想要有一个接受std::string的函数和一个接受任何不是std::string的内容的函数。#include <iostream> std::cout << "string version called" << std::endl;void foo(T&& str) { std::cout << "
浏览 0
提问于2021-04-27
得票数 0
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
Springboot与Elasticsearch完美结合
SpringBoot 与 ZXing 完美结合
数字孪生与游戏科技的完美结合
智慧建筑,技术与管理的完美结合
区块链与酒,创新与传统的完美结合!
热门
标签
更多标签
云服务器
ICP备案
云直播
对象存储
腾讯会议
活动推荐
运营活动
广告
关闭
领券