dynamic pointer cast introduce std::__1? How to deal with it?

Hi, there

I have a line like:

std::shared_ptr<Sub> m1 = std::static_pointer_cast<std::shared_ptr<Sub>>(m);
m1->call();

Where m is a pointer to Sub's base class. This should work fine but I have the following error message:

no viable conversion from 'shared_ptr<std::__1::shared_ptr<Sub >>' to 'shared_ptr<Sub>'

Through search, I guess these may be the reasons:
1. This is in a template.
2. This compiles on clang, who introduce the std::__1

The question is how I can remove this std::__1 to still make the dynamic pointer cast works?

Thank you!
You're using it wrong. See:

http://www.cplusplus.com/reference/memory/static_pointer_cast/?kw=static_pointer_cast

std::shared_ptr<Sub> m1 = std::static_pointer_cast<Sub>(m);
Right. Thank you!
Topic archived. No new replies allowed.