ADMB Documentation  11.1.1927
 All Classes Files Functions Variables Typedefs Friends Defines
lvec1.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: lvec1.cpp 1921 2014-04-23 18:47:05Z 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      if (i>indexmax())
00033      {
00034        ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- index too high",
00035        "AD_LONG_INT& lvector::operator() (int i)", indexmin(), indexmax(), i);
00036      }
00037 
00038      if (i<indexmin())
00039      {
00040        ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- index too low",
00041        "AD_LONG_INT& lvector::operator() (int i)", indexmin(), indexmax(), i);
00042      }
00043    return(*(v+i));
00044  }
00045 
00050  AD_LONG_INT& lvector::operator() (int i)
00051  {
00052      if (i>indexmax())
00053      {
00054        ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- index too high",
00055        "AD_LONG_INT& lvector::operator() (int i)", indexmin(), indexmax(), i);
00056      }
00057      if (i<indexmin())
00058      {
00059        ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- index too low",
00060        "AD_LONG_INT& lvector::operator() (int i)", indexmin(), indexmax(), i);
00061      }
00062    return(*(v+i));
00063  }
00064 #endif