-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathiterator.cpp
71 lines (53 loc) · 1.84 KB
/
iterator.cpp
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
#include "Image.h"
//copy constructor
MSHIMA001::Image::Iterator::Iterator(const Iterator& N){
ptr = N.ptr;
}
MSHIMA001::Image::Iterator::Iterator(unsigned char *p):ptr(p){
}
MSHIMA001::Image::Iterator::~Iterator(){
ptr = nullptr;
}
//move constructor.
MSHIMA001::Image::Iterator::Iterator(Iterator&& N){
ptr = N.ptr;
N = nullptr;
}
/*MSHIMA001::Image::Iterator& MSHIMA001::Image::Iterator::operator=(int&& N ){
*ptr = (unsigned char)N;
return *this;
}*/
//assignment operator
MSHIMA001::Image::Iterator& MSHIMA001::Image::Iterator::operator=(const Iterator& N ){
if(this!=&N){
ptr = N.ptr;
}
return *this;
}
//move assignment operator.
MSHIMA001::Image::Iterator& MSHIMA001::Image::Iterator::operator=(Iterator&& N){
if(this!=&N){
ptr = N.ptr;
}
N = nullptr;
return *this;
}
MSHIMA001::Image::Iterator& MSHIMA001::Image::Iterator::operator+=(int n){
ptr = ptr + n;
return *this;
}
//++ operator
const MSHIMA001::Image::Iterator& MSHIMA001::Image::Iterator::operator++(){
++ptr;
return *this;
}
//--Iterator
const MSHIMA001::Image::Iterator& MSHIMA001::Image::Iterator::operator--(){
ptr--;
return *this;
}
unsigned char& MSHIMA001::Image::Iterator::operator*(){
return *ptr;}
bool MSHIMA001::Image::Iterator::operator!=( const Iterator& N){
return (ptr != N.ptr);
}