Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Koch
dune-common
Commits
f802cd23
Commit
f802cd23
authored
20 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix! insertAfter and deleteNext did not change the size of the list
before. They do now. [[Imported from SVN: r1712]]
parent
3538b1b7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/sllist.hh
+22
-9
22 additions, 9 deletions
common/sllist.hh
with
22 additions
and
9 deletions
common/sllist.hh
+
22
−
9
View file @
f802cd23
...
...
@@ -199,12 +199,12 @@ namespace Dune
public:
inline
SLListIterator
(
typename
SLList
<
T
,
A
>::
Element
*
item
,
typename
SLList
<
T
,
A
>
::
Allocator
&
alloc
)
:
current_
(
item
),
allocator_
(
&
alloc
)
SLList
<
T
,
A
>
*
sllist
)
:
current_
(
item
),
list_
(
sllist
)
{}
inline
SLListIterator
()
:
current_
(
0
),
allocator
_
(
0
)
:
current_
(
0
),
list
_
(
0
)
{}
/**
...
...
@@ -252,19 +252,32 @@ namespace Dune
*/
inline
void
insertAfter
(
const
T
&
v
)
const
{
assert
(
current_
!=
0
&&
allocator
_
!=
0
);
typename
SLList
<
T
,
A
>::
Element
*
added
=
allocator_
->
allocate
(
1
,
0
);
assert
(
current_
!=
0
&&
list
_
!=
0
);
typename
SLList
<
T
,
A
>::
Element
*
added
=
list_
->
allocator_
.
allocate
(
1
,
0
);
added
->
item_
=
v
;
added
->
next_
=
current_
->
next_
;
current_
->
next_
=
added
;
++
(
list_
->
size_
);
}
/**
* @brief Delete the entry after the current position.
*/
inline
void
deleteNext
()
const
{
assert
(
current_
->
next_
!=
0
&&
list_
!=
0
);
typename
SLList
<
T
,
A
>::
Element
*
tmp
=
current_
->
next_
;
current_
->
next_
=
tmp
->
next_
;
list_
->
allocator_
.
destroy
(
tmp
);
list_
->
allocator_
.
deallocate
(
tmp
,
1
);
--
(
list_
->
size_
);
}
private
:
/** @brief The current element. */
typename
SLList
<
T
,
A
>::
Element
*
current_
;
/** @brief The
allocator of the list
. */
typename
SLList
<
T
,
A
>
::
Allocator
*
allocator
_
;
/** @brief The
list we iterate over
. */
SLList
<
T
,
A
>
*
list
_
;
};
/**
...
...
@@ -423,7 +436,7 @@ namespace Dune
template
<
typename
T
,
class
A
>
inline
SLListIterator
<
T
,
A
>
SLList
<
T
,
A
>::
begin
()
{
return
iterator
(
head_
,
allocator_
);
return
iterator
(
head_
,
this
);
}
template
<
typename
T
,
class
A
>
...
...
@@ -435,7 +448,7 @@ namespace Dune
template
<
typename
T
,
class
A
>
inline
SLListIterator
<
T
,
A
>
SLList
<
T
,
A
>::
oneBeforeBegin
()
{
return
iterator
(
&
beforeHead_
,
allocator_
);
return
iterator
(
&
beforeHead_
,
this
);
}
template
<
typename
T
,
class
A
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment