Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Tiago Peixoto
graph-tool
Commits
32746cc8
Commit
32746cc8
authored
Sep 15, 2020
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inference/support/util.hh: use rvalue references
parent
dbc8e6f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/graph/inference/support/util.hh
src/graph/inference/support/util.hh
+3
-3
No files found.
src/graph/inference/support/util.hh
View file @
32746cc8
...
...
@@ -87,7 +87,7 @@ T log_sum(T a, T b)
}
template
<
class
Vec
,
class
PosMap
,
class
Val
>
void
remove_element
(
Vec
&
vec
,
PosMap
&
pos
,
Val
val
)
void
remove_element
(
Vec
&
vec
,
PosMap
&
pos
,
Val
&&
val
)
{
auto
&
back
=
vec
.
back
();
auto
&
j
=
pos
[
back
];
...
...
@@ -98,14 +98,14 @@ void remove_element(Vec& vec, PosMap& pos, Val val)
}
template
<
class
Vec
,
class
PosMap
,
class
Val
>
void
add_element
(
Vec
&
vec
,
PosMap
&
pos
,
Val
val
)
void
add_element
(
Vec
&
vec
,
PosMap
&
pos
,
Val
&&
val
)
{
pos
[
val
]
=
vec
.
size
();
vec
.
push_back
(
val
);
}
template
<
class
Vec
,
class
PosMap
,
class
Val
>
bool
has_element
(
Vec
&
vec
,
PosMap
&
pos
,
Val
val
)
bool
has_element
(
Vec
&
vec
,
PosMap
&
pos
,
Val
&&
val
)
{
size_t
i
=
pos
[
val
];
return
(
i
<
vec
.
size
()
&&
vec
[
i
]
==
val
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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