Sign in to follow this  
Followers 0
Debug

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

2 posts in this topic

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



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  
Followers 0