-
Notifications
You must be signed in to change notification settings - Fork 0
/
Point3D.hpp
61 lines (37 loc) · 1.28 KB
/
Point3D.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Point3D Class
// Damien MATTEI
#ifndef POINT3D_HPP
#define POINT3D_HPP
//#include <string> // std::string
#include <iostream>
#include <sstream> // std::stringstream
#include <iomanip>
using namespace std;
//using std::stringstream;
//using std::string;
// class must be forward declared because it contains a friend function template
//export template<class T> class Point3D;
//template<class T> class Point3D;
// friend function also must be forwards declared
//template<class T> ostream& operator<<(ostream& out, const Point3D<T>& p3d);
template <class T> class Point3D {
public:
T x,y,z; // coords
#ifdef CHECK_MEMORY
static inline int cpt_cons; // for verifying memory allocation/desallocation , note: inline require C++ 2017
// without inline the variable is not seen at link stage
#endif
Point3D();
~Point3D();
Point3D(T x,T y,T z);
// copy constructor
Point3D(const Point3D<T> &);
std::string display(void);
// assignation operator
Point3D<T> & operator=(const Point3D<T> &);
// equality operator
bool operator== (const Point3D<T> &);
//friend ostream& operator<< (ostream &out, Point3D<T> &p3d);
};
template <class T> std::ostream& operator<< (std::ostream &out, const Point3D<T> &p3d);
#endif /* POINT3D_HPP */