#ifndef KGR_KANGARU_INCLUDE_KANGARU_DETAIL_SINGLE_HPP #define KGR_KANGARU_INCLUDE_KANGARU_DETAIL_SINGLE_HPP #include "traits.hpp" #include "meta_list.hpp" namespace kgr { struct Single { Single() = default; ~Single() = default; Single(const Single&) = delete; Single& operator=(const Single&) = delete; Single(Single&&) = default; Single& operator=(Single&&) = default; }; struct Abstract {}; template struct Default { using DefaultService = T; }; template struct Overrides { using ParentTypes = detail::meta_list; }; namespace detail { template struct parent_type_helper { using ParentTypes = meta_list<>; }; template struct parent_type_helper> { using ParentTypes = typename T::ParentTypes; }; template using parent_types = typename parent_type_helper::ParentTypes; template struct default_type_helper { using has_default = std::false_type; }; template struct default_type_helper> { using has_default = std::true_type; using Service = typename T::DefaultService; }; template using default_type = typename default_type_helper::Service; template using has_default = typename default_type_helper::has_default; template using is_abstract_service = std::integral_constant::value || std::is_abstract::value>; template using is_single = std::integral_constant::value || is_abstract_service::value>; template using is_overriden_by = meta_list_contains>; } // namespace detail } // namespace kgr #endif // KGR_KANGARU_INCLUDE_KANGARU_DETAIL_SINGLE_HPP