I setup a class with:
class Example {
static const float array[3][8];
};
and implemented
inline const float below_center(const float pos) {
return pos - (size / 2); // size is a const float
}
inline const float above_center(const float pos) {
return pos + (size / 2);
}
inline const float *set_pos(const float x, const float y) {
return (float []) {
below_center(x), below_center(y),
below_center(x), above_center(y),
above_center(x), below_center(y),
above_center(x), above_center(y),
};
}
const float Example::array[3][8] = {
set_pos(2.0f, 0.0f),
set_pos(-1.0f, -1.0f),
set_pos(1.0f, -1.0f),
};
But when I do this I get an error saying, “‘const float*’ to ‘const float’ in initialization”. I understand what the error saying, but the hell is it saying ‘const float’ and how can implement my array with broken down inline functions.
You can’t do like that. Use macros: