I want to know the meaning of code mixed with standard libraries.

Asked 2 years ago, Updated 2 years ago, 28 views

If you know what the code below is doing, please let me know.

std::sheard_ptr<std::vector<std::sheard_ptr<RxInfos>>>rxinfo;

c++

2022-09-29 21:22

2 Answers

As for what you're doing, we just have variables, but
Use typeef or using for these complicated types
It may be easy to understand if you take it apart.I usually do that.

//std::shared_ptr<std::vector<std::shared_ptr<RxInfos>>rxinfo; when decomposing...
using RxInfos_Ptr=std::shared_ptr<RxInfos>;
using RxInfos_Ptr_Vct=std::vector<RxInfos_Ptr>;
using RxInfos_Ptr_Vct_Ptr=std::shared_ptr<RxInfos_Ptr_Vct>;
RxInfos_Ptr_Vct_Ptrxinfo;// Ultimately this


2022-09-29 21:22

Quote the std::shared_ptr commentary from cpprefjp.

shared_ptr is a smart pointer that shares (share) ownership of a given resource.

Based on this, the source you provided declared shared_ptr to the vector of shared_ptr to RxInfo (I don't know exactly what RxInfos is...).


2022-09-29 21:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.