Skip to content

Commit 28294af

Browse files
paulgessingerandresailer
authored andcommitted
Make VariantParameters::value_or const
1 parent 63f67eb commit 28294af

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

DDRec/include/DDRec/DetectorData.h

+11-2
Original file line numberDiff line numberDiff line change
@@ -517,13 +517,22 @@ namespace dd4hep {
517517
const T& get(const std::string& key) const {
518518
auto it = variantParameters.find(key);
519519
if(it == variantParameters.end()) {
520-
throw std::runtime_error{"Key "+key+"not found"};
520+
throw std::runtime_error{"Key "+key+" not found"};
521521
}
522522
return boost::get<T>(it->second);
523523
}
524524

525525
template <typename T>
526-
T value_or(const std::string& key, T alternative) {
526+
T& get(const std::string& key) {
527+
auto it = variantParameters.find(key);
528+
if(it == variantParameters.end()) {
529+
throw std::runtime_error{"Key "+key+" not found"};
530+
}
531+
return boost::get<T>(it->second);
532+
}
533+
534+
template <typename T>
535+
T value_or(const std::string& key, T alternative) const {
527536
auto it = variantParameters.find(key);
528537
if(it == variantParameters.end()) {
529538
return alternative;

0 commit comments

Comments
 (0)