I have a library with function, which looks like this:
template<typename S1> void NastyFunction(S1 *array, EntryType S1::* member1);
So if I have an array of structs like:
struct TData {
float a;
float b[10];
};
TData dataArray[N];
I can apply NastyFunction
to all a
-s in dataArray
using:
NastyFunction( dataArray, &TData::a );
How to apply this NastyFunction
to all for example b[7]
-s in dataArray
?
You can't. While the entire array is a member of the class, its individual elements are not, so there is no way to make a member pointer point at them.