-
Notifications
You must be signed in to change notification settings - Fork 1
/
RVector.cct
132 lines (114 loc) · 4.15 KB
/
RVector.cct
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Copyright 2008 by Robert Dick.
// All rights reserved.
/*###########################################################################*/
template <typename T>
inline T &
RVector<T>::operator[](size_type a) {
#ifdef ROB_DEBUG
if (a >= size() || a < 0) {
std::cerr << "For datatype " << typeid(*this).name() << ": size = " <<
size() << ". Reference = " << a << ".\n";
Rabort();
}
#endif
return impl_[a];
}
/*===========================================================================*/
template <typename T>
inline const T &
RVector<T>::operator[](size_type a) const {
return runconst(*this)[a];
}
/*===========================================================================*/
template <typename T> template <class InIter>
void RVector<T>::assign(InIter first, InIter last) {
impl_.assign(first, last);
}
/*===========================================================================*/
template <typename T>
typename RVector<T>::iterator
RVector<T>::insert(iterator pos, const T & x) {
return impl_.insert(pos, x);
}
/*===========================================================================*/
template <typename T> template <typename InIter>
void RVector<T>::insert(iterator pos, InIter first,
InIter last) {
impl_.insert(pos, first, last);
}
/*===========================================================================*/
template <typename T>
void RVector<T>::insert(iterator pos, size_type n, const T & x) {
impl_.insert(pos, n, x);
}
/*===========================================================================*/
template <typename T>
RVector<T> &
RVector<T>::operator=(const self & a) {
impl_ = a.impl_;
return *this;
}
/*===========================================================================*/
template <typename T>
comp_type
RVector<T>::comp_default(const self & b) const {
return comp_cont(*this, b);
}
/*===========================================================================*/
template <typename T>
void RVector<T>::self_check_deep() const {
self_check();
map_self_check_deep(begin(), end());
}
/*###########################################################################*/
template <int DIM, typename T, template <int, typename> class INDEX>
MVector<DIM, T, INDEX>::MVector(size_t n,
typename super::const_reference value) :
super(n, value)
{}
/*===========================================================================*/
template <int DIM, typename T, template <int, typename> class INDEX>
template <typename IT>
T &
MVector<DIM, T, INDEX>::operator[](const INDEX<DIM, IT> & indx) {
return dim_index<IT>(indx.begin());
}
/*===========================================================================*/
template <int DIM, typename T, template <int, typename> class INDEX>
template <typename IT>
const T &
MVector<DIM, T, INDEX>::operator[](const INDEX<DIM, IT> & indx) const {
return dim_index<IT>(indx.begin());
}
/*===========================================================================*/
template <int DIM, typename T, template <int, typename> class INDEX>
typename MVector<DIM, T, INDEX>::const_reference
MVector<DIM, T, INDEX>::operator[](size_type a) const {
return super::operator[](a);
}
/*===========================================================================*/
template <int DIM, typename T, template <int, typename> class INDEX>
template <typename IT>
T & MVector<DIM, T, INDEX>::dim_index(const IT * i) {
return (*this)[*i].dim_index(i + 1);
}
/*===========================================================================*/
template <int DIM, typename T, template <int, typename> class INDEX>
template <typename IT>
const T & MVector<DIM, T, INDEX>::dim_index(const IT * i) const {
return (*this)[*i].dim_index(i + 1);
}
/*################################o##########################################*/
template <typename T, template <int, typename> class INDEX>
template <typename IT>
T &
MVector<1, T, INDEX>::operator[](const INDEX<1, IT> & a) {
return dim_index<IT>(a.begin());
}
/*===========================================================================*/
template <typename T, template <int, typename> class INDEX>
template <typename IT>
const T &
MVector<1, T, INDEX>::operator[](const INDEX<1, IT> & a) const {
return dim_index<IT>(a.begin());
}