Tuesday, 10 September 2013

C++ send array of 2 integers as argument

C++ send array of 2 integers as argument

I am trying to make this C++ code more abstract, easier to see and
understand, and less space occupier. It is a function that takes a string
and two integers for a size and a position.
HWND CreateButon(string Title, const int[2] Size, const int[2] Position) {
// Create the control, assign title, size and position
// Return HWND
}
HWND MyButton = CreateButton("Button1", [100, 20], [10, 10]);
I know the last one is wrong. I just wrote it that way so you can see what
I mean. I would like to send the size and position values directly as an
argument. I could use structs but they must be declared before. The same
with some other kind of variables. I just want to send them in the
arguments as groups of two integers and I wonder if there's a workaround
for it. More than anything else it's just for the sake of having it
compact and simple.

No comments:

Post a Comment