Sabhareesh Ravichandran Sabhareesh Ravichandran - 9 months ago 51
C++ Question

Does default argument of template class, instantiate the template?

Does the following default argument for the template instantiates a template with type


class EmptyClass{};

template <typename TYPE=EmptyClass>
class Sample
static void test()

Answer Source

No, in that code any instance of EmptyClass is created. Serialize is a static function. And EmptyClass's constructor is never called (in code showed)