V
Vladimir
Hello!
I'd like to select one of possible entities according to a given index:
select(index, A, B)
would return A if index is 0, B if index is (or greater than) 1.
so i write:
template<typename T> T select(int index, T a, T b)
{
return (index == 0) ? a : b;
}
this works fine when calling selected function:
select(index, somefunction0, somefunction1)(args...)
but fails for class member functions - what should I do?
Ideally I want it universal, without the need
to rewrite select() for each class.
I'd like to select one of possible entities according to a given index:
select(index, A, B)
would return A if index is 0, B if index is (or greater than) 1.
so i write:
template<typename T> T select(int index, T a, T b)
{
return (index == 0) ? a : b;
}
this works fine when calling selected function:
select(index, somefunction0, somefunction1)(args...)
but fails for class member functions - what should I do?
Ideally I want it universal, without the need
to rewrite select() for each class.