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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
diff -Nur enigma-0.81-orig/src/px/array2.hh enigma-0.81/src/px/array2.hh
--- src/px/array2.hh 2003-05-19 14:14:36.000000000 +0200
+++ src/px/array2.hh 2004-11-11 00:04:26.855388248 +0100
@@ -70,14 +70,14 @@
// Destructor
~Array2() { destroy_elements(); }
- iterator begin() { return first; }
- iterator end() { return last; }
- const_iterator begin() const { return first; }
- const_iterator end() const { return last; }
- iterator row_begin(size_type y) { return first + y*w; }
- iterator row_end(size_type y) { return first + y*w + w; }
- const_iterator row_begin(size_type y) const { return first + y*w; }
- const_iterator row_end(size_type y) const { return first + y*w + w; }
+ iterator begin() { return this->first; }
+ iterator end() { return this->last; }
+ const_iterator begin() const { return this->first; }
+ const_iterator end() const { return this->last; }
+ iterator row_begin(size_type y) { return this->first + y*w; }
+ iterator row_end(size_type y) { return this->first + y*w + w; }
+ const_iterator row_begin(size_type y) const { return this->first + y*w; }
+ const_iterator row_end(size_type y) const { return this->first + y*w + w; }
void swap(Array2<T,A> &a2);
@@ -86,13 +86,13 @@
size_type height()const { return h; }
- T& get(size_type x, size_type y) { return first[y*w+x]; }
- const T& get(size_type x, size_type y) const { return first[y*w+x]; }
+ T& get(size_type x, size_type y) { return this->first[y*w+x]; }
+ const T& get(size_type x, size_type y) const { return this->first[y*w+x]; }
T& operator()(size_type x, size_type y) { return get(x,y); }
const T& operator()(size_type x, size_type y) const { return get(x,y); }
void set(size_type x, size_type y, const T& val) {
- first[y*w+x] = val;
+ this->first[y*w+x] = val;
}
/*! Fill the array with some value or the default value. */
@@ -112,19 +112,19 @@
Array2<T,A>::Array2(int ww, int hh, const T& val, const A& a)
: Array2Base<T,A>(a, ww*hh), w(ww), h(hh)
{
- std::uninitialized_fill(first, last, val);
+ std::uninitialized_fill(this->first, this->last, val);
}
template <class T, class A>
Array2<T,A>::Array2(const Array2<T,A> &a)
: Array2Base<T,A>(a.alloc, a.last-a.first)
{
- std::uninitialized_copy(a.begin(), a.end(), first);
+ std::uninitialized_copy(a.begin(), a.end(), this->first);
}
template <class T, class A>
void Array2<T,A>::destroy_elements() {
- for (T* p=first; p!=last; ++p)
+ for (T* p=this->first; p!=this->last; ++p)
p->~T();
}
@@ -132,7 +132,7 @@
void Array2<T,A>::fill (const T& val)
{
destroy_elements();
- std::uninitialized_fill(first, last, val);
+ std::uninitialized_fill(this->first, this->last, val);
}
/*! Resize the array in place, but discard any old array
@@ -142,7 +142,7 @@
{
destroy_elements();
Array2Base<T,A>::resize(w_*h_);
- std::uninitialized_fill(first, last, val);
+ std::uninitialized_fill(this->first, this->last, val);
w = w_;
h = h_;
}
@@ -150,8 +150,8 @@
template <class T, class A>
void Array2<T,A>::swap(Array2<T,A> &a2)
{
- std::swap(first, a2.first);
- std::swap(last, a2.last);
+ std::swap(this->first, a2.first);
+ std::swap(this->last, a2.last);
std::swap(w, a2.w);
std::swap(h, a2.h);
}
|