Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
Spot
Commits
c7b3148c
Commit
c7b3148c
authored
Jan 23, 2014
by
Alexandre Duret-Lutz
Browse files
* src/tgbaalgos/degen.cc (unicity_table): Simplify.
parent
bd6d88db
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/tgbaalgos/degen.cc
View file @
c7b3148c
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Développement
// de l'Epita.
// -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita.
//
// This file is part of Spot, a model checking library.
//
...
...
@@ -69,32 +70,23 @@ namespace spot
// Memory management for the input states.
class
unicity_table
{
typedef
std
::
unordered_set
<
const
state
*
,
state_ptr_hash
,
state_ptr_equal
>
uniq_set
;
uniq_set
m
;
state_set
m
;
public:
const
state
*
operator
()(
const
state
*
s
)
{
uniq_set
::
const_iterator
i
=
m
.
find
(
s
);
if
(
i
==
m
.
end
())
{
m
.
insert
(
s
);
return
s
;
}
else
{
s
->
destroy
();
return
*
i
;
}
auto
p
=
m
.
insert
(
s
);
if
(
!
p
.
second
)
s
->
destroy
();
return
*
p
.
first
;
}
~
unicity_table
()
{
for
(
uniq
_set
::
iterator
i
=
m
.
begin
();
i
!=
m
.
end
();)
for
(
state
_set
::
iterator
i
=
m
.
begin
();
i
!=
m
.
end
();)
{
// Advance the iterator before destroying its key. This
// avoid issues with old g++ implementations.
uniq
_set
::
iterator
old
=
i
++
;
state
_set
::
iterator
old
=
i
++
;
(
*
old
)
->
destroy
();
}
}
...
...
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