Your operator overloads (
operator==
andoperator()
) should beconst
since they don't modify any data members.operator<<
can just be a single line. It could also use"\n"
instead ofstd::endl
so that one isn't forced to have a buffer flush when invoking it (there is a different between the two there is a different between the two).return o << "(" << p.x << ", " << p.y << ", " << p.z << ")\n";
This can be shortened:
if (points.size() == 0) { vector<Point> empty; return empty; }
by using
empty()
and by returning an anonymousvector
instead:if (points.empty()) { return vector<Point>(); }
Your operator overloads (
operator==
andoperator()
) should beconst
since they don't modify any data members.operator<<
can just be a single line. It could also use"\n"
instead ofstd::endl
so that one isn't forced to have a buffer flush when invoking it (there is a different between the two).return o << "(" << p.x << ", " << p.y << ", " << p.z << ")\n";
This can be shortened:
if (points.size() == 0) { vector<Point> empty; return empty; }
by using
empty()
and by returning an anonymousvector
instead:if (points.empty()) { return vector<Point>(); }
Your operator overloads (
operator==
andoperator()
) should beconst
since they don't modify any data members.operator<<
can just be a single line. It could also use"\n"
instead ofstd::endl
so that one isn't forced to have a buffer flush when invoking it (there is a different between the two).return o << "(" << p.x << ", " << p.y << ", " << p.z << ")\n";
This can be shortened:
if (points.size() == 0) { vector<Point> empty; return empty; }
by using
empty()
and by returning an anonymousvector
instead:if (points.empty()) { return vector<Point>(); }
Your operator overloads (
operator==
andoperator()
) should beconst
since they don't modify any data members.operator<<
can just be a single line. It could also use"\n"
instead ofstd::endl
so that one isn't forced to have a buffer flush when invoking it (there is a different between the two).return o << "(" << p.x << ", " << p.y << ", " << p.z << ")\n";
This can be shortened:
if (points.size() == 0) { vector<Point> empty; return empty; }
by using
empty()
and by returning an anonymousvector
instead:if (points.empty()) { return vector<Point>;vector<Point>(); }
Your operator overloads (
operator==
andoperator()
) should beconst
since they don't modify any data members.operator<<
can just be a single line. It could also use"\n"
instead ofstd::endl
so that one isn't forced to have a buffer flush when invoking it (there is a different between the two).return o << "(" << p.x << ", " << p.y << ", " << p.z << ")\n";
This can be shortened:
if (points.size() == 0) { vector<Point> empty; return empty; }
by using
empty()
and by returning an anonymousvector
instead:if (points.empty()) { return vector<Point>; }
Your operator overloads (
operator==
andoperator()
) should beconst
since they don't modify any data members.operator<<
can just be a single line. It could also use"\n"
instead ofstd::endl
so that one isn't forced to have a buffer flush when invoking it (there is a different between the two).return o << "(" << p.x << ", " << p.y << ", " << p.z << ")\n";
This can be shortened:
if (points.size() == 0) { vector<Point> empty; return empty; }
by using
empty()
and by returning an anonymousvector
instead:if (points.empty()) { return vector<Point>(); }
Your operator overloads (
operator==
andoperator()
) should beconst
since they don't modify any data members.operator<<
can just be a single line. It could also use"\n"
instead ofstd::endl
so that one isn't forced to have a buffer flush when invoking it (there is a different between the two).return o << "(" << p.x << ", " << p.y << ", " << p.z << ")\n";
This can be shortened:
if (points.size() == 0) { vector<Point> empty; return empty; }
by using
empty()
and by returning an anonymousvector
instead:if (points.empty()) { return vector<Point>; }