diff options
-rw-r--r-- | slicer/slicer/modelPartsTypes.h | 6 | ||||
-rw-r--r-- | slicer/slicer/modelPartsTypes.impl.h | 29 |
2 files changed, 10 insertions, 25 deletions
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h index f9c76d4..9cc8ac9 100644 --- a/slicer/slicer/modelPartsTypes.h +++ b/slicer/slicer/modelPartsTypes.h @@ -177,12 +177,6 @@ namespace Slicer { [[nodiscard]] bool HasValue() const override; [[nodiscard]] TypeId GetTypeId() const override; - template<typename dummy = T> - const std::string & getTypeId( - typename std::enable_if<std::is_base_of<Ice::Object, dummy>::value>::type * = nullptr) const; - template<typename dummy = T> - std::string getTypeId( - typename std::enable_if<!std::is_base_of<Ice::Object, dummy>::value>::type * = nullptr) const; [[nodiscard]] std::optional<std::string> GetTypeIdProperty() const override; diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h index cb24fe4..af3f980 100644 --- a/slicer/slicer/modelPartsTypes.impl.h +++ b/slicer/slicer/modelPartsTypes.impl.h @@ -564,25 +564,16 @@ namespace Slicer { { BOOST_ASSERT(this->Model); BOOST_ASSERT(className); - return ModelPartForComplexBase::GetTypeId(getTypeId(), *className); - } - - template<typename T> - template<typename dummy> - const std::string & - ModelPartForClass<T>::getTypeId(typename std::enable_if<std::is_base_of<Ice::Object, dummy>::value>::type *) const - { - BOOST_ASSERT(this->Model); - return (*this->Model)->ice_id(); - } - - template<typename T> - template<typename dummy> - std::string - ModelPartForClass<T>::getTypeId(typename std::enable_if<!std::is_base_of<Ice::Object, dummy>::value>::type *) const - { - BOOST_ASSERT(this->Model); - return ModelPartForComplexBase::demangle(typeid(*this->Model->get()).name()); + return ModelPartForComplexBase::GetTypeId( + [this]() { + if constexpr (std::is_base_of_v<Ice::Object, T>) { + return (*this->Model)->ice_id(); + } + else { + return ModelPartForComplexBase::demangle(typeid(*this->Model->get()).name()); + } + }(), + *className); } // ModelPartForStruct |