你可以让它像
const int width = 1280, height = 720;
struct MandelbrotBase {
int width = ::width, height = ::height;
struct {
int x;
int y;
} pos = {.x = width / 2, .y = height / 2};
} mb;
void generate_mandelbrot(unsigned int* colors, MandelbrotBase mb) {}
非静态
width
和
height
不能在外部引用
MandelbrotBase
没有对象的成员。未命名的结构不是该结构的一部分
MandelbrotBase
定义,未命名的结构体只是在结构体中定义的
MandelbrotBase
名称范围。