Posted by John Kugelman on April 19, 2001 at 14:35:11:
In Reply to: storing location, to variables, one return type posted by Nathan on April 18, 2001 at 20:58:20:
There are three practical ways to do this.
Use two different accessors, like
Use reference parameters and store the coordinates in them. For example:
void location (int &x, int &y);
This is pretty simple to use, except that it requires you to have two variables to store the results in.
The other option is to use a
pair template, which is part of the STL. This is a nice solution because it is explicit that you are returning something. And if the template name is too long you can hide it behind a
typedef, as in
typedef pair < int, int > Location;
Post a Followup