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