How to reorder function parameters?
9
Look at the pseudo-c++ code below:
typedef *** SomeType1;
typedef *** SomeType2;
typedef *** SomeType3;
void BFunc(SomeType1& st1, SomeType2& st2, SomeType3& st3)
{
/*some work*/;
}
template <typename T1, typename T2, typename T3>
void AFunc(T1& p1, T2& p2, T3& p3)
{
BFunc(???);
}
There are two functions with parameters. The parameters count larger than three, but for simplicity for example let it would be three.
The Afunc
- it is the templated function that have the same parameters count as the BFunc
plus the parameters have the same types as the BFunc
parameters. But (!) the sequence on the parameters of BFunc
can (or cannot) be different. For example:
BFunc(int, double, char)
AFunc<double, int, char>
AFunc<int, double, char>
AFunc<char, double, int>
AFunc<char, int, double>
...
So how to reorder parameters inside AFunc
for calling BFunc
with correct parameters sequence?
c++ templates
AFunc
should be allowed to specify its arguments in any order? Is that flexibility really necessary? – 0x5453 Apr 1 at 15:21BFunc
will never have two parameters with the same type? – NathanOliver Apr 1 at 15:27