diff --git a/ReflectionTemplateLib/builder/inc/ConstructorBuilder.h b/ReflectionTemplateLib/builder/inc/ConstructorBuilder.h index 8cb70b16..190ed279 100644 --- a/ReflectionTemplateLib/builder/inc/ConstructorBuilder.h +++ b/ReflectionTemplateLib/builder/inc/ConstructorBuilder.h @@ -6,7 +6,7 @@ namespace rtl { namespace builder { - template + template class ConstructorBuilder { const std::string& m_record; @@ -23,32 +23,4 @@ namespace rtl { inline constexpr const access::Function build() const; }; } - - - namespace builder - { - template<> - class ConstructorBuilder<> - { - public: - - template - static constexpr const ConstructorBuilder<_recordType, _signature...> - select(const std::string& pNamespace, const std::string& pRecord, - enable_if_same<_recordType&, typename detail::TypeId<_signature...>::HEAD > *_= nullptr); - - - template - static constexpr const ConstructorBuilder<_recordType, _signature...> - select(const std::string& pNamespace, const std::string& pRecord, - enable_if_same::HEAD > *_= nullptr); - - - template - static constexpr const ConstructorBuilder<_recordType, _signature...> - select(const std::string& pNamespace, const std::string& pRecord, - enable_if_not_same<_recordType&, typename detail::TypeId<_signature...>::HEAD > *_= nullptr, - enable_if_not_same::HEAD > *__= nullptr); - }; - } } \ No newline at end of file diff --git a/ReflectionTemplateLib/builder/inc/ConstructorBuilder.hpp b/ReflectionTemplateLib/builder/inc/ConstructorBuilder.hpp index 5f8047b9..d2b9ae7e 100644 --- a/ReflectionTemplateLib/builder/inc/ConstructorBuilder.hpp +++ b/ReflectionTemplateLib/builder/inc/ConstructorBuilder.hpp @@ -39,35 +39,4 @@ namespace rtl { } } } - - - namespace builder - { - template - inline constexpr const ConstructorBuilder<_recordType, _signature...> - ConstructorBuilder<>::select(const std::string& pNamespace, const std::string& pRecord, - enable_if_same<_recordType&, typename detail::TypeId<_signature...>::HEAD > *_) - { - return ConstructorBuilder<_recordType, _signature...>(pNamespace, pRecord, FunctorType::CopyCtor); - } - - - template - inline constexpr const ConstructorBuilder<_recordType, _signature...> - ConstructorBuilder<>::select(const std::string& pNamespace, const std::string& pRecord, - enable_if_same::HEAD > *_) - { - return ConstructorBuilder<_recordType, _signature...>(pNamespace, pRecord, FunctorType::CopyCtorConst); - } - - - template - inline constexpr const ConstructorBuilder<_recordType, _signature...> - ConstructorBuilder<>::select(const std::string& pNamespace, const std::string& pRecord, - enable_if_not_same<_recordType&, typename detail::TypeId<_signature...>::HEAD > *_, - enable_if_not_same::HEAD > *__) - { - return ConstructorBuilder<_recordType, _signature...>(pNamespace, pRecord, FunctorType::Ctor); - } - } } \ No newline at end of file diff --git a/ReflectionTemplateLib/builder/inc/RecordBuilder.hpp b/ReflectionTemplateLib/builder/inc/RecordBuilder.hpp index a119ad1e..1e4d401d 100644 --- a/ReflectionTemplateLib/builder/inc/RecordBuilder.hpp +++ b/ReflectionTemplateLib/builder/inc/RecordBuilder.hpp @@ -18,7 +18,15 @@ namespace rtl { template inline constexpr const ConstructorBuilder<_recordType, _signature...> RecordBuilder<_recordType>::constructor() const { - return ConstructorBuilder<>::select<_recordType, _signature...>(m_namespace, m_record); + if constexpr (std::is_same_v<_recordType&, typename detail::TypeId<_signature...>::HEAD>) { + return ConstructorBuilder<_recordType, _signature...>(m_namespace, m_record, FunctorType::CopyCtor); + } + else if constexpr (std::is_same_v::HEAD>) { + return ConstructorBuilder<_recordType, _signature...>(m_namespace, m_record, FunctorType::CopyCtorConst); + } + else { + return ConstructorBuilder<_recordType, _signature...>(m_namespace, m_record, FunctorType::Ctor); + } }