-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint2D.h
More file actions
73 lines (60 loc) · 2 KB
/
Point2D.h
File metadata and controls
73 lines (60 loc) · 2 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef POINT2D_H
#define POINT2D_H
#include <vector>
#include "SimplePoint2D.h"
#include <memory>
using namespace std;
class Point2D {
private:
class Impl;
unique_ptr<Impl> pimpl;
public:
struct Iterator{
public:
using iterator_category = input_iterator_tag;
using difference_type = ptrdiff_t;
using value_type = SimplePoint2D;
using pointer = SimplePoint2D*;
using reference = SimplePoint2D&;
Iterator() {m_ptr = nullptr;}
Iterator(pointer ptr): m_ptr(ptr){}
const reference operator*()const{return *m_ptr;}
const pointer operator->(){return m_ptr;}
Iterator& operator++()
{
m_ptr++;
return *this;
}
Iterator operator++(int)
{
Iterator tmp = *this;
++(*this);
return tmp;
}
friend bool operator==(const Iterator& a, const Iterator& b)
{
return a.m_ptr == b.m_ptr;
};
friend bool operator!=(const Iterator& a, const Iterator& b)
{
return a.m_ptr != b.m_ptr;
};
friend bool operator<(const Iterator& a, const Iterator& b)
{
return a.m_ptr < b.m_ptr;
};
private:
pointer m_ptr;
};
Point2D();
Point2D(vector<SimplePoint2D> _pointCollection, bool _ordered);
Point2D(vector<SimplePoint2D> _pointCollection);
Point2D(Point2D const &sourcePoint2D);
Point2D(Point2D &&sourcePoint2D);
~Point2D();
int count();
Iterator begin();
Iterator end();
};
//Point2D randomPoint2D(long count, int minX, int maxX, int minY, int maxY);
#endif //POINT2D_H