26 #ifndef _CXSC_INTVECTOR_INL_INCLUDED
27 #define _CXSC_INTVECTOR_INL_INCLUDED
29 #include "intvector.hpp"
45 dat=
new int[i._int()];
51 throw(ERROR_INTVECTOR_WRONG_BOUNDARIES,ERROR_INTVECTOR_NO_MORE_MEMORY):l(i1),u(i2),size(i2-i1+1)
53 throw():l(i1),u(i2),size(i2-i1+1)
57 if(i1>i2) cxscthrow(ERROR_INTVECTOR_WRONG_BOUNDARIES(
"intvector::intvector(const int &i1,const int &i2)"));
65 for(
int i=0, j=l-rs.l;i<size;i++,j++)
72 for (
int i=0;i<size;i++)
78 throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC)
84 if(i<start||i>end) cxscthrow(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC(
"int & intvector_slice::operator [](const int &i)"));
91 throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC)
97 if(i<start||i>end) cxscthrow(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC(
"int & intvector_slice::operator [](const int &i)"));
103 #if(CXSC_INDEX_CHECK)
104 throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC)
109 #if(CXSC_INDEX_CHECK)
110 if(i<l||i>u) cxscthrow(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC(
"int & intvector::operator [](const int &i)"));
116 #if(CXSC_INDEX_CHECK)
117 throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC)
122 #if(CXSC_INDEX_CHECK)
123 if(i<l||i>u) cxscthrow(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC(
"int & intvector::operator [](const int &i)"));
135 #if(CXSC_INDEX_CHECK)
136 throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG)
141 #if(CXSC_INDEX_CHECK)
142 if(1<l||i>u) cxscthrow(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG(
"intvector_slice intvector::operator ()(const int &i)"));
155 #if(CXSC_INDEX_CHECK)
156 throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG)
161 #if(CXSC_INDEX_CHECK)
162 if(i1<l||i2>u) cxscthrow(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG(
"intvector_slice intvector::operator ()(const int &i1,const int &i2)"));
168 #if(CXSC_INDEX_CHECK)
169 throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG)
174 #if(CXSC_INDEX_CHECK)
175 if(1<start||i>end) cxscthrow(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG(
"intvector_slice intvector_slice::operator ()(const int &i)"));
181 #if(CXSC_INDEX_CHECK)
182 throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG)
187 #if(CXSC_INDEX_CHECK)
188 if(i1<start||i2>end) cxscthrow(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG(
"intvector_slice intvector_slice::operator ()(const int &i1,const int &i2)"));
195 INLINE intvector::operator
void*()
throw() {
return _vvoid(*
this); }
198 #if(CXSC_INDEX_CHECK)
199 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
203 {
return _vsvsassign<intvector_slice,intvector_slice>(*
this,sl); }
205 #if(CXSC_INDEX_CHECK)
206 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
210 {
return _vsvassign<intvector_slice,intvector>(*
this,rv); }
212 INLINE intvector_slice::operator
void*()
throw() {
return _vsvoid(*
this); }
224 #if(CXSC_INDEX_CHECK)
225 throw(ERROR__WRONG_BOUNDARIES<intvector>)
229 { _vresize<intvector,int>(rv,len); }
231 #if(CXSC_INDEX_CHECK)
232 throw(ERROR__WRONG_BOUNDARIES<intvector>)
236 { _vresize<intvector,int>(rv,lb,ub); }
240 INLINE
bool operator !(
const intvector &rv)
throw() {
return _vnot(rv); }
263 #if(CXSC_INDEX_CHECK)
264 throw(OP_WITH_WRONG_DIM)
268 { _vvaccu(dp,rv1,rv2); }
272 #if(CXSC_INDEX_CHECK)
273 throw(OP_WITH_WRONG_DIM)
277 { _vsvaccu(dp,sl,rv); }
279 #if(CXSC_INDEX_CHECK)
280 throw(OP_WITH_WRONG_DIM)
284 { _vsvaccu(dp,sl,rv); }
286 #if(CXSC_INDEX_CHECK)
287 throw(OP_WITH_WRONG_DIM)
291 { _vsvsaccu(dp,sl1,sl2); }
296 #if(CXSC_INDEX_CHECK)
297 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
301 {
return _vvplus<intvector,intvector,intvector>(rv1,rv2); }
303 #if(CXSC_INDEX_CHECK)
304 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
308 {
return _vvsplus<intvector,intvector_slice,intvector>(rv,sl); }
310 #if(CXSC_INDEX_CHECK)
311 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
315 {
return _vvsplus<intvector,intvector_slice,intvector>(rv,sl); }
317 #if(CXSC_INDEX_CHECK)
318 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
322 {
return _vsvsplus<intvector_slice,intvector_slice,intvector>(sl1,sl2); }
324 #if(CXSC_INDEX_CHECK)
325 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
329 {
return _vvplusassign(rv1,rv2); }
331 #if(CXSC_INDEX_CHECK)
332 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
336 {
return _vvsplusassign(rv,sl); }
338 #if(CXSC_INDEX_CHECK)
339 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
343 {
return _vsvplusassign(*
this,rv); }
345 #if(CXSC_INDEX_CHECK)
346 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
350 {
return _vsvsplusassign(*
this,sl2); }
355 #if(CXSC_INDEX_CHECK)
356 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
360 {
return _vvminus<intvector,intvector,intvector>(rv1,rv2); }
362 #if(CXSC_INDEX_CHECK)
363 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
367 {
return _vvsminus<intvector,intvector_slice,intvector>(rv,sl); }
369 #if(CXSC_INDEX_CHECK)
370 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
374 {
return _vsvminus<intvector_slice,intvector,intvector>(sl,rv); }
376 #if(CXSC_INDEX_CHECK)
377 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
381 {
return _vsvsminus<intvector_slice,intvector_slice,intvector>(sl1,sl2); }
383 #if(CXSC_INDEX_CHECK)
384 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
388 {
return _vvminusassign(rv1,rv2); }
390 #if(CXSC_INDEX_CHECK)
391 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
395 {
return _vvsminusassign(rv,sl); }
397 #if(CXSC_INDEX_CHECK)
398 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
402 {
return _vsvminusassign(*
this,rv); }
404 #if(CXSC_INDEX_CHECK)
405 throw(ERROR__OP_WITH_WRONG_DIM<intvector>)
409 {
return _vsvsminusassign(*
this,sl2); }
411 INLINE
bool operator ==(
const intvector &rv1,
const intvector &rv2)
throw() {
return _vveq(rv1,rv2); }
415 INLINE
bool operator !=(
const intvector &rv1,
const intvector &rv2)
throw() {
return _vvneq(rv1,rv2); }
419 INLINE
bool operator <(
const intvector &rv1,
const intvector &rv2)
throw() {
return _vvless(rv1,rv2); }
423 INLINE
bool operator <=(
const intvector &rv1,
const intvector &rv2)
throw() {
return _vvleq(rv1,rv2); }
427 INLINE
bool operator >(
const intvector &rv1,
const intvector &rv2)
throw() {
return _vvless(rv2,rv1); }
431 INLINE
bool operator >=(
const intvector &rv1,
const intvector &rv2)
throw() {
return _vvleq(rv2,rv1); }
436 INLINE std::ostream &operator <<(std::ostream &s,
const intvector &rv)
throw() {
return _vout(s,rv); }
437 INLINE std::ostream &operator <<(std::ostream &o,
const intvector_slice &sl)
throw() {
return _vsout(o,sl); }
438 INLINE std::istream &operator >>(std::istream &s,
intvector &rv)
throw() {
return _vin(s,rv); }
439 INLINE std::istream &operator >>(std::istream &s,
intvector_slice &rv)
throw() {
return _vsin(s,rv); }
441 INLINE intvector perminv(
const intvector& x) {
443 for(
int i=0 ; i<
VecLen(x) ; i++)