M
Marco Nawijn
Hello,
I have a short question regarding the use of templates.
I have a template definition like the following:
template <typename T, uint64_t N=1>
T func(const stream &s)
{
// code..
}
Now, depending on whether N=1 or N>1 I would like to
return a variable of type T itself, or a vector<T>.
Is this possible with one template, or should I just
create a second template? If it is possible, how
should the return value of the function be specified?
Regards,
Marco
I have a short question regarding the use of templates.
I have a template definition like the following:
template <typename T, uint64_t N=1>
T func(const stream &s)
{
// code..
}
Now, depending on whether N=1 or N>1 I would like to
return a variable of type T itself, or a vector<T>.
Is this possible with one template, or should I just
create a second template? If it is possible, how
should the return value of the function be specified?
Regards,
Marco