Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DD4hep
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cepc
externals
mirroring
DD4hep
Commits
28294afb
Commit
28294afb
authored
2 years ago
by
Paul Gessinger
Committed by
Andre Sailer
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make VariantParameters::value_or const
parent
63f67eb7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DDRec/include/DDRec/DetectorData.h
+11
-2
11 additions, 2 deletions
DDRec/include/DDRec/DetectorData.h
with
11 additions
and
2 deletions
DDRec/include/DDRec/DetectorData.h
+
11
−
2
View file @
28294afb
...
@@ -517,13 +517,22 @@ namespace dd4hep {
...
@@ -517,13 +517,22 @@ namespace dd4hep {
const
T
&
get
(
const
std
::
string
&
key
)
const
{
const
T
&
get
(
const
std
::
string
&
key
)
const
{
auto
it
=
variantParameters
.
find
(
key
);
auto
it
=
variantParameters
.
find
(
key
);
if
(
it
==
variantParameters
.
end
())
{
if
(
it
==
variantParameters
.
end
())
{
throw
std
::
runtime_error
{
"Key "
+
key
+
"not found"
};
throw
std
::
runtime_error
{
"Key "
+
key
+
"
not found"
};
}
}
return
boost
::
get
<
T
>
(
it
->
second
);
return
boost
::
get
<
T
>
(
it
->
second
);
}
}
template
<
typename
T
>
template
<
typename
T
>
T
value_or
(
const
std
::
string
&
key
,
T
alternative
)
{
T
&
get
(
const
std
::
string
&
key
)
{
auto
it
=
variantParameters
.
find
(
key
);
if
(
it
==
variantParameters
.
end
())
{
throw
std
::
runtime_error
{
"Key "
+
key
+
" not found"
};
}
return
boost
::
get
<
T
>
(
it
->
second
);
}
template
<
typename
T
>
T
value_or
(
const
std
::
string
&
key
,
T
alternative
)
const
{
auto
it
=
variantParameters
.
find
(
key
);
auto
it
=
variantParameters
.
find
(
key
);
if
(
it
==
variantParameters
.
end
())
{
if
(
it
==
variantParameters
.
end
())
{
return
alternative
;
return
alternative
;
...
...
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