I am trying to understand the Cpp reference document - https://en.cppreference.com/w/cpp/container/vector
I saw that the signature of vector is
template<
class T,
class Allocator = std::allocator<T>
> class vector;
My understanding is that class T is allowing the vector to pass the type it wants like vector, vector, vector, etc. So, the compiler should do the magic for the primitive types but for custom class types, I am sure I might have to implement some copy constructor, etc. Basically, class T means the type of vector here.
I thought to make something similar in nature but I get this error.
#include <iostream>
template<class T> class myExp;
int main() {
myExp<int> t;
return 0;
}
I am sure I am missing some template fundamentals here. When I compile I get the error -
/tmp/fRK0p8KnAQ.cpp:10:16: error: aggregate 'myExp<int> t' has incomplete type and cannot be defined
10 | myExp<int> t;
| ^