简体   繁体   中英

How to return the pointer in a pointer in a pointer

I feel like this should be very easy, but I am unable to find an applicable question.

X is a shared_ptr<shared_ptr<Item> > .

I have a function that accepts a shared_ptr<Item>

How do I get that inner pointer? I can't just do X -> , and X->get() will return an Item*

与普通指针一样,可以通过取消引用共享指针的目标来访问它:

f(*X);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM