summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/slicer/modelPartsTypes.cpp6
-rw-r--r--slicer/slicer/modelPartsTypes.h3
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h4
3 files changed, 11 insertions, 2 deletions
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp
index ffaec04..04fc859 100644
--- a/slicer/slicer/modelPartsTypes.cpp
+++ b/slicer/slicer/modelPartsTypes.cpp
@@ -357,6 +357,12 @@ namespace Slicer {
const ModelPartType ModelPartForDictionaryBase::type = ModelPartType::Dictionary;
+ void
+ ModelPartForDictionaryBase::throwIncorrectElementName(const std::string_view name)
+ {
+ throw IncorrectElementName(std::string {name});
+ }
+
// Streams
ModelPartType
ModelPartForStreamBase::GetType() const
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index f581c49..c81e014 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -297,6 +297,9 @@ namespace Slicer {
[[nodiscard]] bool HasValue() const override;
[[nodiscard]] ModelPartType GetType() const override;
static const ModelPartType type;
+
+ protected:
+ [[noreturn]] static void throwIncorrectElementName(const std::string_view);
};
template<typename T> class ModelPartForDictionary : public ModelPartForDictionaryBase, protected ModelPartModel<T> {
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index 60f221d..692437e 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -681,8 +681,8 @@ namespace Slicer {
const SubPartHandler & ch, std::string_view name, const HookFilter &, MatchCase matchCase)
{
BOOST_ASSERT(this->Model);
- if (!optionalCaseEq(name, pairName, matchCase == MatchCase::Yes)) {
- throw IncorrectElementName(std::string {name});
+ if (!optionalCaseEq(name, pairName, matchCase == MatchCase::Yes)) [[unlikely]] {
+ ModelPartForDictionaryBase::throwIncorrectElementName(name);
}
ch(ModelPartForDictionaryElementInserter<T>(this->Model), emptyMetadata);
return true;