Jump to content
Sign in to follow this  
Debug

C++ Strip boost::shared_ptr from a template parameter

Recommended Posts

Debug

I am developing a C++ template library that uses both primitive types and pointer types stored in boost::shared_ptr. I am having a problem with a helper class that is used to pack primitive types into a container class if necessary before being passed into a lower layer of the library. The following shows the basic type that just passes the pointer on, and the implementation for std::string which is one of the primitives.

Posted Image

The rr_cast<>() function is an alias to dynamic_pointer_cast. The problem I am having is that for the general case, the template "T" includes the "boost::shared_ptr" prefix because this type may or may not interact with a shared_ptr. The prefix messes up the dynamic_pointer_cast, because it expects just the pointer type. Is there a clean way to work around this?

Share this post


Link to post
Share on other sites
JohnOne

I do not know the answer sorry, but if you don't mind I would like to ask you a question.

Just out of curiosity, why did you specifically register on an autoit forum to ask a C++ question?


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×