ADMB Documentation  11.1.1920
 All Classes Files Functions Variables Typedefs Friends Defines
lvec2.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: lvec2.cpp 1919 2014-04-22 22:02:01Z johnoel $
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    #ifdef SAFE_ARRAYS
00033      if (i>indexmax())
00034      {
00035        cerr << "array bound exceeded -- index too high in lvector::operator[]";
00036        ad_exit(1);
00037      }
00038 
00039      if (i<indexmin())
00040      {
00041        cerr << "array bound exceeded -- index too low in lvector::operator[]";
00042        ad_exit(1);
00043      }
00044    #endif
00045    return(*(v+i));
00046  }
00047 
00052 const AD_LONG_INT& lvector::operator()(int i) const
00053  {
00054    #ifdef SAFE_ARRAYS
00055      if (i>indexmax())
00056      {
00057        cerr << "array bound exceeded -- index too high in lvector::operator[]";
00058        ad_exit(1);
00059      }
00060 
00061      if (i<indexmin())
00062      {
00063        cerr << "array bound exceeded -- index too low in lvector::operator[]";
00064        ad_exit(1);
00065      }
00066    #endif
00067    return(*(v+i));
00068  }
00069 #endif