There is a section of code in a library I use that looks like this:
...
if ( ptype == typeid( Vector< T, 4 > ) )
{
This->SetNumberOfComponents(4);
}
else if ( ptype == typeid( Vector< T, 5 > ) )
{
This->SetNumberOfComponents(5);
}
...
If there any way to make this more generic by doing something like
if ( ptype == typeid( Vector< T, ANYTHING > ) )
{
This->SetNumberOfComponents(THE_SECOND_TEMPLATE_PARAM);
}
?
Thanks,
David
We took Roger Pate's suggestion of removing the use of typeid by restructuring a little bit (It was the first comment, so I couldn't mark it as the answer). Thanks for all of the great ideas and discussion!