M
mati
Suppose there is some complex functor, and we are using some helper
functions inside:
class Func {
private:
inline void helper(...) {...}
public:
RetType operator()(const &data, Type1 param1, Type2 param2, ...)
{
const Type1 precomputed_param1 = some_heavy_math(param1, ...);
...
... //with excessive use of helper functions
}
};
However, this helper function needs a lots of parameters, some
precomputed in operator(), some given to it (ex. param1,param2).
Question is - how to pass data references/pointers and parameters to the
helper functions? With a remark, that helpers needs to be fast (inline
is a must).
Two ideas are:
1. Pass to function by reference/value.
2. Use private Func data members.
However, 1. yelds large argument list, and 2. can't deal with parameters
passed to operator() as references, also parameters can't be const
(which is a good thing).
I haven't come up with anything 100% nice and fast, so I'm asking here,
maybe there is a way.
Thanks
functions inside:
class Func {
private:
inline void helper(...) {...}
public:
RetType operator()(const &data, Type1 param1, Type2 param2, ...)
{
const Type1 precomputed_param1 = some_heavy_math(param1, ...);
...
... //with excessive use of helper functions
}
};
However, this helper function needs a lots of parameters, some
precomputed in operator(), some given to it (ex. param1,param2).
Question is - how to pass data references/pointers and parameters to the
helper functions? With a remark, that helpers needs to be fast (inline
is a must).
Two ideas are:
1. Pass to function by reference/value.
2. Use private Func data members.
However, 1. yelds large argument list, and 2. can't deal with parameters
passed to operator() as references, also parameters can't be const
(which is a good thing).
I haven't come up with anything 100% nice and fast, so I'm asking here,
maybe there is a way.
Thanks