comparison liboctave/Array.cc @ 2006:95e952f72d66

[project @ 1996-03-04 00:33:32 by jwe]
author jwe
date Mon, 04 Mar 1996 00:40:14 +0000
parents 1b57120c997b
children 468a96dd03fc
comparison
equal deleted inserted replaced
2005:c1ffef39e94a 2006:95e952f72d66
92 92
93 return *this; 93 return *this;
94 } 94 }
95 95
96 template <class T> 96 template <class T>
97 T&
98 Array<T>::checkelem (int n)
99 {
100 if (n < 0 || n >= rep->length ())
101 {
102 (*current_liboctave_error_handler) ("range error");
103 static T foo;
104 return foo;
105 }
106 return elem (n);
107 }
108
109 template <class T>
110 T
111 Array<T>::elem (int n) const
112 {
113 return rep->elem (n);
114 }
115
116 template <class T>
117 T
118 Array<T>::checkelem (int n) const
119 {
120 if (n < 0 || n >= rep->length ())
121 {
122 (*current_liboctave_error_handler) ("range error");
123 T foo;
124 static T *bar = &foo;
125 return foo;
126 }
127 return elem (n);
128 }
129
130 template <class T>
131 T
132 Array<T>::operator () (int n) const
133 {
134 return checkelem (n);
135 }
136
137 template <class T>
138 void 97 void
139 Array<T>::resize (int n) 98 Array<T>::resize (int n)
140 { 99 {
141 if (n < 0) 100 if (n < 0)
142 { 101 {