I'm getting my feet wet with aliasing in templated classes, and haven't been able to compile the following code:
template <class T> using item_ptr = std::shared_ptr<T>;
class Container
{
std::vector<item_ptr> list;
};
I get two compile errors, a type-value mismatch at argument 1 in template parameter list
, and a template argument 2 is invalid.
However, if I write the following code instead:
template <class T> //using item_ptr = std::shared_ptr<T>;
class Container
{
std::vector<std::shared_ptr<T>> list;
};
then it compiles without errors. According to my understanding, these two statements should do the same thing. What am I not understanding correctly?