[ADMB Users] extraction of array elements using selection logic

dave fournier davef at otter-rsch.com
Mon Feb 25 15:57:24 PST 2013


> #include <admodel.h>
> #include <cstddef>
>
> main()
> {
>   double * ptr=new double[1000];
>
>   double * current_ptr=ptr+1000;
>
>   char * pc=(char*) ptr;
>   char * cc=(char*) current_ptr;
>   std::ptrdiff_t pd=current_ptr-ptr;
>   cout << pd << endl;
>   std::ptrdiff_t ppd=cc-pc;
>   cout << ppd << endl;
> }

Another thing we could do is to add  thing like overloaded operator ()
to the classes. then you could write

     N = M("!=",2,0.0);

where the string gets parsed so that we can have

    N=M("==",2,0.0);

or

    N=M("<=",2,27.0);

> ~
> ~
> ~ 



More information about the Users mailing list