Suppose I have some template class forward declared and I want to typedef a shared pointer to it. How would I do this?
template<typename T> class Arg;
typedef std::tr1::shared_ptr<Arg> ArgPtr; // Compiler error
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You also probably want template typedef. Read up on Sutter’s article.
In C++03, you need a hack as:
In C++11, you can use template aliasing directly with the
usingkeyword: