ADMB Documentation
-a65f1c97
Main Page
Function Reference
Classes
Source Code
Related Pages
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
tools99
clist.cpp
Go to the documentation of this file.
1
8
#include "
clist.h
"
9
#include <new>
10
11
clist
*
clist::prev
()
const
12
{
13
clist
* t = this->
next
;
14
while
(t !=
this
)
15
{
16
if
(!t)
17
{
18
//unexpected
19
throw
std::bad_alloc();
20
}
21
else
if
(t->
next
==
this
)
22
{
23
return
t;
24
}
25
else
26
{
27
t = t->
next
;
28
}
29
}
30
return
0;
31
}
32
33
int
clist::length
(
const
int
&
max
)
const
34
{
35
int
num = 1;
36
clist
* t = this->
next
;
37
while
(num <= max)
38
{
39
if
(!t)
40
{
41
//unexpected
42
throw
std::bad_alloc();
43
}
44
else
if
(t ==
this
)
45
{
46
return
num;
47
}
48
else
49
{
50
t = t->
next
;
51
}
52
++num;
53
}
54
return
-1;
55
}
56
60
clist::clist
(
const
clist
& t)
61
{
62
clist
& tmp=*(
clist
*)(&t);
63
next
= t.
next
;
64
tmp.
next
=
this
;
65
}
66
70
clist::~clist
()
71
{
72
if
(
next
==
this
)
73
{
74
next
= 0;
75
}
76
else
77
{
78
prev
()->
next
=
next
;
79
}
80
}
clist::length
int length(const int &max=1000) const
Definition:
clist.cpp:33
clist::prev
clist * prev() const
Definition:
clist.cpp:11
clist::~clist
~clist()
Destructor.
Definition:
clist.cpp:70
clist::clist
clist()
Definition:
clist.h:49
clist
Definition:
clist.h:43
clist.h
clist::next
clist * next
Definition:
clist.h:48
max
#define max(a, b)
Definition:
cbivnorm.cpp:189
Generated on Wed Sep 7 2022 00:01:26 for ADMB Documentation by
1.8.5