ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
lvec2.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include "fvar.hpp"
00012 
00013 #ifdef __TURBOC__
00014   #pragma hdrstop
00015   #include <iostream.h>
00016 #endif
00017 
00018 #ifdef __ZTC__
00019   #include <iostream.hpp>
00020 #endif
00021 
00022 #include <stdlib.h>
00023 
00024 #ifndef OPT_LIB
00025 
00030 const AD_LONG_INT& lvector::operator[](int i) const
00031  {
00032      if (i>indexmax())
00033      {
00034        cerr << "array bound exceeded -- index too high in lvector::operator[]";
00035        ad_exit(1);
00036      }
00037 
00038      if (i<indexmin())
00039      {
00040        cerr << "array bound exceeded -- index too low in lvector::operator[]";
00041        ad_exit(1);
00042      }
00043    return(*(v+i));
00044  }
00045 
00050 const AD_LONG_INT& lvector::operator()(int i) const
00051  {
00052      if (i>indexmax())
00053      {
00054        cerr << "array bound exceeded -- index too high in lvector::operator[]";
00055        ad_exit(1);
00056      }
00057 
00058      if (i<indexmin())
00059      {
00060        cerr << "array bound exceeded -- index too low in lvector::operator[]";
00061        ad_exit(1);
00062      }
00063    return(*(v+i));
00064  }
00065 #endif