So what I want to do is to create a template class which may or may not contain a member variable based on the template argument passed in. like following:
t
I think this is what you are looking for.
The class template does not have any member data by default.
template class base { };
Add a specialization of the class template that has the member data.
template class base { foov m_var; };