腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
1
回答
将
std
::
vector
<
std
::
shared_ptr
<
T
>>转
换为
std
::
vector
<
std
::
shared_ptr
<
const
T
>>
c++
、
c++11
、
casting
、
smart-pointers
我有三个班级成员: public:
std
::
vector
<
std
::
shared_ptr
<
const
Object> > getObjects()
const
;
std
::
vector
&
浏览 66
提问于2019-06-05
得票数 2
5
回答
使用
std
::
vector
<
std
::
shared_ptr
<
const
T
> >是反模式吗?
c++
、
templates
、
c++11
、
c++-standard-library
很长一段时间以来,我一直在手拉手地使用
std
::
vector
和
std
::
shared_ptr
。最近,每当需要指向
const
对象的指针时,我就开始使用
std
::
shared_ptr
<
const
T
>。这一切都很好,因为
std
::
shared_ptr
<
T
>可以转
换为
std
::
shared_ptr
<<em
浏览 3
提问于2014-06-06
得票数 24
回答已采纳
2
回答
如何
将
shared_ptr
<Derived>的向量转
换为
shared_ptr
<Base>?
c++
、
vector
、
shared-ptr
ConvertVecBasePtr(
const
vector
<
std
::
shared_ptr
<Base>>& p) return p.size(); {
vector
<
std
::
shared_ptr
<Derived>> d; return 0;我得到了ConvertVecBasePtr的错误error C266
浏览 21
提问于2021-03-24
得票数 0
2
回答
将
vector
<shared_pt<
T
>>复制到
vector
<
shared_ptr
<
const
T
>> (不同情况) C++
c++
、
c++11
、
c++14
我有一个:我想把它复制到现在我注意到,如果我这样做:{ A(
const
std
::
vector
<
std
浏览 3
提问于2016-09-01
得票数 7
回答已采纳
1
回答
c++模板函数对矢量向量的平坦化
c++
、
templates
、
vector
例如:
std
::
vector
<
std
::
shared_ptr
<
std
::
vector
<int>>>::
vector
<
std
::
shared_ptr
<
st
浏览 1
提问于2017-08-25
得票数 3
回答已采纳
3
回答
C++向量半常数
c++
、
stl
、
vector
我希望从具有以下属性的方法返回一个
std
::
vector
:接收方(用户)将能够编辑向量中的元素,但不能更改向量本身(调整大小、删除、添加等)。如果我返回一个
std
::
vector
<
T
>&,接收方将能够调整它的大小,向它添加元素,等等。 如果我返回
std
:
浏览 2
提问于2012-10-31
得票数 2
5
回答
是否
将
指针容器转
换为
智能指针?
c++
、
pointers
、
boost
、
stl
、
smart-pointers
有没有一种简洁、通用的方法来转换常规/哑型指针的
std
容器(如
vector
):例如,boost::
shared_ptr
?:我想我可以使用
vector
的range构造函数来实现:...
vector</e
浏览 1
提问于2011-01-25
得票数 3
回答已采纳
2
回答
C++模板
shared_ptr
到
const
的实例化
c++
、
constants
、
shared-ptr
、
implicit-conversion
、
template-argument-deduction
假设我有一堂课class A { template <typename V>
std
::tr1::
shared_ptr
<
const
std
::
vec
浏览 3
提问于2011-04-08
得票数 4
回答已采纳
2
回答
错误C2440:‘初始化’:无法从'
std
::
vector
<_Ty>‘转
换为
'
const
std
::
vector
<_Ty> &`
c++
、
boost
#include <iostream>#include "boost/shared_ptr.hpp" {}; {
std
::
vector
<boost::
shared_ptr
<SubClass>> vecSub
浏览 28
提问于2013-02-27
得票数 3
2
回答
将
C++模板“constexpr”转
换为
旧的“标记分派”方法
c++
、
templates
、
c++17
、
tag-dispatching
我的目标是有一个单独的解析函数,在
将
数据传递给其他函数之前,可以根据模板
T
类型执行特定的解析。
shared_ptr
<Bar> parseBar(
const
string & data) { return make_shared<Bar>(); }
浏览 2
提问于2018-10-23
得票数 2
回答已采纳
1
回答
为什么在
shared_ptr
中允许移动
const
_iterator?
c++11
、
iterator
、
constants
、
shared-ptr
、
move
移动
shared_ptr
会将移动的
shared_ptr
设置为nullptr,那么为什么允许它在
const
_iterator中这样做呢?
std
::
vector
<
std
::
shared_ptr
<
std
::string>> sharedPtrVector; sharedPtrVector.push_back(
std
::
shared_ptr
<
std
::string>(n
浏览 1
提问于2014-10-12
得票数 1
回答已采纳
4
回答
使用模板函数打印智能指针向量
c++
、
c++11
、
vector
、
smart-pointers
template <typename
T
>
std
::cout << ">>;
std
::cout <<
std
::endl << "--------------------" &l
浏览 1
提问于2018-03-12
得票数 0
回答已采纳
1
回答
基于范围的用于STL容器
stl
、
for-loop
、
c++11
::end(
const
_Container&) [with _Container =
std
::
vector
<boost::
shared_ptr
<Node> >, decltype (__cont->end()) = __gnu_cxx::__normal_iterator<
const
boost::
shared_ptr
<Node>*,
std
::
vector
<boost::
sha
浏览 0
提问于2011-07-29
得票数 4
回答已采纳
1
回答
Quantlib SWIG python安装失败
macos
、
swig
、
quantlib
::
vector
<
T
,
std
::allocator<_CharT> > >::asptr(PyObject*,
std
::
vector
<
T
,
std
::allocator<_CharT> >**) [::asptr(PyObject*, Seq**) [with Seq =
std
::
vector
<
std
::
vector
<boost
浏览 1
提问于2015-07-10
得票数 0
3
回答
如何在模板类中使用结构作为成员
c++
、
class
、
templates
、
struct
template<typename
T
>public: using Ptr =
std
::
shared_ptr
<Node>;
std
::
vector
<
std
::pair<Ptr, int>> children; Node(
T
da
浏览 4
提问于2020-09-08
得票数 0
回答已采纳
3
回答
函数模板
将
shared_ptr
向量填充到基派生对象
c++
、
templates
、
inheritance
、
shared-ptr
、
stdvector
//
T
might be either a Base or a Derived class.{
浏览 0
提问于2019-08-13
得票数 2
回答已采纳
1
回答
C++:自定义数据类型向量错误队列
c++
、
vector
、
queue
错误C2664 '
std
::
vector
>::
vector
(
std
::
vector
<_Ty,
std
::allocator<_Ty>> &&,
const
_Alloc &) to _Alloc():无法
将
参数2从'int‘转
换为
'
const
std
::allocator<_Ty> &’。data_q
浏览 0
提问于2018-08-11
得票数 1
1
回答
使用
std
::make_shared在C++中使用"Type“代码中的类和结构有什么区别?
c++
<
T
>>(
std
::forward<
T
>(
t
))) {} {}; void printName(
std
::
vector
&l
浏览 1
提问于2022-03-31
得票数 1
回答已采纳
1
回答
在unordered_map中从向量中删除元素
c++
、
c++11
、
stdvector
、
unordered-map
在我的课堂上,我有一个无序的向量映射,如下所示:我们班也有以下两种方法: void addCity(State state,
const
std
::
shared_ptr
<
const
City>&
浏览 2
提问于2021-03-14
得票数 0
回答已采纳
2
回答
在从向量中删除
shared_ptr
之前,我需要重置它吗?
c++
、
shared-ptr
、
smart-pointers
::string
const
&name,
std
::
vector
<
std
::
shared_ptr
<Resource>> &resourceList)
std
::
vector
<
std
::
shared_ptr
::string
const
&name,
std
::
vector
<
std
::
s
浏览 1
提问于2014-05-15
得票数 3
回答已采纳
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
实现线程安全队列——细粒度锁实现
智能指针:让C+程序更加安全和高效的神器
C++20:核心语言
C+实现xml解析器
你们以为我在学C加加?其实我在学Python!人生苦短!
热门
标签
更多标签
云服务器
即时通信 IM
ICP备案
对象存储
实时音视频
活动推荐
运营活动
广告
关闭
领券