A
amphetaman
I have a very simple class for storing two-dimensional coordinates:
class Point
{
public:
Point();
Point(const Point &);
Point &operator(const Point &);
int x;
int y;
};
If I want a constructor that takes two ints, is it better to pass by
value or by reference? In other words, Point(int, int) or Point(const
int &, const int &)? (Or maybe Point(const int, const int)? Does that
actually improve performance?)
class Point
{
public:
Point();
Point(const Point &);
Point &operator(const Point &);
int x;
int y;
};
If I want a constructor that takes two ints, is it better to pass by
value or by reference? In other words, Point(int, int) or Point(const
int &, const int &)? (Or maybe Point(const int, const int)? Does that
actually improve performance?)