Efficiency Quesstion

Hello,
Let's say we have a custom Vector class and I need to know which of the following is considered to be more efficient and why of course.

1
2
3
4
5
6
7
8
9
10
11
12
13
14

Vector Vector::operator+(const Vector &b) const
{
 return Vector(x+b.x,y+b.y);
}
					


Vector Vector::operator+(const Vector &b) const
{
Vector tmp(x+b.x,y+b.y);
 return tmp;
}


Thank You !
The 2 versions are equivalent.
Topic archived. No new replies allowed.