My original code looks like this:
class a{
...
char buff[10];
}
and im attempting to make this change to the code:
template <int N = 10>
class a{
...
char buff[N];
}
Is there any thing I can do to keep my existing code creating instances of class a like this:
a test;
instead of making the change to:
a<> test;
to get the default parameter?
You can’t instantiate a template without angle-brackets, and you can’t give a type the same name as a template, so you can’t do exactly what you want.
You could give the template a different name, and typedef
ato the default-sized one.