0

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*

1
  • why double shared_ptr??? Commented Oct 28, 2013 at 18:38

1 Answer 1

3

As with a normal pointer, you access a shared pointer's target by dereferencing it:

f(*X);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.