class C
{
struct S
{
T a;
T2 b;
.
.
.
T z;
};
int compute(S s[]);
}
So I need this compute()
method to work on the structure S in on of two ways (runtime selectable).
One case is to estimate something on base of
a
,b
and the other contents of structureS
, excludingz
.Other times I need the exact same computations, but taking
z
instead (and in place of)a
. They both are the same type and have the same meaning.
The structure S
is exposed in the API and thus need to be stored in exactly this layout.
What would be an efficient (compute()
is being called rather often) end elegant solution? bool
parameter? enum
parameter? Template parameter (if so, how to implement it)?
NOTES:
compute()
is quite a long function, with selectinga
orz
happening exactly once