Skip to content

Commit

Permalink
make minivec objects streamable
Browse files Browse the repository at this point in the history
  • Loading branch information
berthubert committed Sep 11, 2022
1 parent 05a6c6f commit 6702f01
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions minivec.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <math.h>
#include <iostream>

struct Point
{
Expand All @@ -10,6 +11,13 @@ struct Point
double x, y, z;
};

inline std::ostream& operator<<(std::ostream& os, const Point& p)
{
os << '(' << p.x << ", " << p.y << ", " << p.z <<')';
return os;
}


struct Vector
{
Vector() : x{0}, y{0}, z{0} {}
Expand Down Expand Up @@ -39,4 +47,9 @@ struct Vector
}
};

inline std::ostream& operator<<(std::ostream& os, const Vector& p)
{
os << '(' << p.x << ", " << p.y << ", " << p.z <<')';
return os;
}

0 comments on commit 6702f01

Please sign in to comment.