From a speed and efficiency standpoint: which is considered best-practice, create a temporary object or decompose a (possibly temporary) argument object?
In this example the implementations of the functions are mutually exclusive for DRY purposes. Both WILL NOT be implemented as shown, but one will be implemented in terms of the other which will delegate the actual work.
void SetPoints(double xA, double yA, double xB, double yB, double xC, double yC);
void SetPoints(const Point& A, const Point& B, const Point& C);
///Option one: create temporary objects:
void SetPoints(double xA, double yA, double xB, double yB, double xC, double yC) {
SetPoints(Point(xA, yA), Point(xB, yB), Point(xC, yC));
}
//Option two: decompose object arguments
void SetPoints(const Point& A, const Point& B, const Point& C) {
SetPoints(A.GetX(), A.GetY(), B.GetX(), B.GetY(), C.GetX(), C.GetY());
}
Overwhelmingly likely to be completely irrelevant. The compiler will likely not even generate different assembly for the two, and even if it did, the performance cost of a tiny thunk would be negligible. There’s no reason to even think about this.
The best function is the one that is the most clear/etc, in this case.