Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
1b2c360e
Commit
1b2c360e
authored
Sep 10, 2008
by
mattijs
Browse files
write access to size
parent
e41580f0
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/containers/Lists/List/List.C
View file @
1b2c360e
...
...
@@ -321,7 +321,7 @@ List<T>::List(const BiIndirectList<T>& idl)
template
<
class
T
>
List
<
T
>::~
List
()
{
if
(
this
->
size
_
)
delete
[]
this
->
v_
;
if
(
this
->
v
_
)
delete
[]
this
->
v_
;
}
...
...
@@ -367,9 +367,8 @@ void List<T>::setSize(const label newSize)
register
T
*
av
=
&
nv
[
i
];
while
(
i
--
)
*--
av
=
*--
vv
;
}
delete
[]
this
->
v_
;
}
if
(
this
->
v_
)
delete
[]
this
->
v_
;
this
->
size_
=
newSize
;
this
->
v_
=
nv
;
...
...
@@ -400,7 +399,7 @@ void List<T>::setSize(const label newSize, const T& a)
template
<
class
T
>
void
List
<
T
>::
clear
()
{
if
(
this
->
size
_
)
delete
[]
this
->
v_
;
if
(
this
->
v
_
)
delete
[]
this
->
v_
;
this
->
size_
=
0
;
this
->
v_
=
0
;
}
...
...
@@ -411,7 +410,7 @@ void List<T>::clear()
template
<
class
T
>
void
List
<
T
>::
transfer
(
List
<
T
>&
a
)
{
if
(
this
->
size
_
)
delete
[]
this
->
v_
;
if
(
this
->
v
_
)
delete
[]
this
->
v_
;
this
->
size_
=
a
.
size_
;
this
->
v_
=
a
.
v_
;
...
...
@@ -457,7 +456,8 @@ void List<T>::operator=(const UList<T>& a)
{
if
(
a
.
size_
!=
this
->
size_
)
{
if
(
this
->
size_
)
delete
[]
this
->
v_
;
if
(
this
->
v_
)
delete
[]
this
->
v_
;
this
->
v_
=
0
;
this
->
size_
=
a
.
size_
;
if
(
this
->
size_
)
this
->
v_
=
new
T
[
this
->
size_
];
}
...
...
@@ -503,7 +503,8 @@ void List<T>::operator=(const SLList<T>& sll)
{
if
(
sll
.
size
()
!=
this
->
size_
)
{
if
(
this
->
size_
)
delete
[]
this
->
v_
;
if
(
this
->
v_
)
delete
[]
this
->
v_
;
this
->
v_
=
0
;
this
->
size_
=
sll
.
size
();
if
(
this
->
size_
)
this
->
v_
=
new
T
[
this
->
size_
];
}
...
...
@@ -530,7 +531,8 @@ void List<T>::operator=(const IndirectList<T>& idl)
{
if
(
idl
.
size
()
!=
this
->
size_
)
{
if
(
this
->
size_
)
delete
[]
this
->
v_
;
if
(
this
->
v_
)
delete
[]
this
->
v_
;
this
->
v_
=
0
;
this
->
size_
=
idl
.
size
();
if
(
this
->
size_
)
this
->
v_
=
new
T
[
this
->
size_
];
}
...
...
@@ -551,7 +553,8 @@ void List<T>::operator=(const BiIndirectList<T>& idl)
{
if
(
idl
.
size
()
!=
this
->
size_
)
{
if
(
this
->
size_
)
delete
[]
this
->
v_
;
if
(
this
->
v_
)
delete
[]
this
->
v_
;
this
->
v_
=
0
;
this
->
size_
=
idl
.
size
();
if
(
this
->
size_
)
this
->
v_
=
new
T
[
this
->
size_
];
}
...
...
src/OpenFOAM/containers/Lists/List/List.H
View file @
1b2c360e
...
...
@@ -137,6 +137,9 @@ public:
//- Return a null List
static
const
List
<
T
>&
null
();
//- Return the number of elements in the UList.
inline
label
size
()
const
;
// Edit
...
...
@@ -156,6 +159,10 @@ public:
//- Return subscript-checked element of UList.
inline
T
&
newElmt
(
const
label
);
//- Override size to be inconsistent with allocated storage.
// Use with care.
inline
label
&
size
();
// Member operators
...
...
src/OpenFOAM/containers/Lists/List/ListI.H
View file @
1b2c360e
...
...
@@ -52,6 +52,20 @@ inline T& Foam::List<T>::newElmt(const label i)
}
template
<
class
T
>
inline
Foam
::
label
Foam
::
List
<
T
>::
size
()
const
{
return
UList
<
T
>::
size_
;
}
template
<
class
T
>
inline
Foam
::
label
&
Foam
::
List
<
T
>::
size
()
{
return
UList
<
T
>::
size_
;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template
<
class
T
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment