Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 1 addition & 29 deletions ReflectionTemplateLib/builder/inc/ConstructorBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace rtl {

namespace builder
{
template<class _recordType = void, class ..._ctorSignature>
template<class _recordType, class ..._ctorSignature>
class ConstructorBuilder
{
const std::string& m_record;
Expand All @@ -23,32 +23,4 @@ namespace rtl {
inline constexpr const access::Function build() const;
};
}


namespace builder
{
template<>
class ConstructorBuilder<>
{
public:

template<class _recordType, class ..._signature>
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<class _recordType, class ..._signature>
static constexpr const ConstructorBuilder<_recordType, _signature...>
select(const std::string& pNamespace, const std::string& pRecord,
enable_if_same<const _recordType&, typename detail::TypeId<_signature...>::HEAD > *_= nullptr);


template<class _recordType, class ..._signature>
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<const _recordType&, typename detail::TypeId<_signature...>::HEAD > *__= nullptr);
};
}
}
31 changes: 0 additions & 31 deletions ReflectionTemplateLib/builder/inc/ConstructorBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,4 @@ namespace rtl {
}
}
}


namespace builder
{
template<class _recordType, class ..._signature>
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<class _recordType, class ..._signature>
inline constexpr const ConstructorBuilder<_recordType, _signature...>
ConstructorBuilder<>::select(const std::string& pNamespace, const std::string& pRecord,
enable_if_same<const _recordType&, typename detail::TypeId<_signature...>::HEAD > *_)
{
return ConstructorBuilder<_recordType, _signature...>(pNamespace, pRecord, FunctorType::CopyCtorConst);
}


template<class _recordType, class ..._signature>
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<const _recordType&, typename detail::TypeId<_signature...>::HEAD > *__)
{
return ConstructorBuilder<_recordType, _signature...>(pNamespace, pRecord, FunctorType::Ctor);
}
}
}
10 changes: 9 additions & 1 deletion ReflectionTemplateLib/builder/inc/RecordBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ namespace rtl {
template<class ..._signature>
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<const _recordType&, typename detail::TypeId<_signature...>::HEAD>) {
return ConstructorBuilder<_recordType, _signature...>(m_namespace, m_record, FunctorType::CopyCtorConst);
}
else {
return ConstructorBuilder<_recordType, _signature...>(m_namespace, m_record, FunctorType::Ctor);
}
}


Expand Down