So I have a function that requires two characters and two ints:
void need_2xcha_2xint(char a, char b, int x, int y)
{
cout << "Working! a: " << a << ", b: " << b << ", x : " << x << ", y: " << y << ".\n";
}
I would like to call it by passing a single struct that contains the four values:
struct Value_Holder
{
char a;
char b;
int x;
int y;
Value_Holder()
: a('g'), b('h'), x(3), y(5)
{
}
};
I want to be able to call it as follows :
Value_Holder vh;
need_2xcha_2xint(vh);
Of course I could write another function that accepts my custom structure and deals with it appropriate, but I was wondering if there's a way to tell the struct to output four seperate values directly. This will mainly be used for interacting with DirectX libraries.
I'm sure this is basic stuff, but I've been working on so many different areas of c++ it's hard to remember everything. I've searched for the answer for a while now, but I'm not quite sure what I should be searching for. My google skills fail me!
Thanks in advance.
- EDIT -
As it seems people are confused by my qustions I'll try and simplify it here:
Is there a way for a function that requires 2 ints and 2 chars to accept a single structure holding these values instead of four seperate values?
I hope that clarifies my question.