mirror of
https://github.com/boostorg/openmethod.git
synced 2026-01-19 04:22:12 +00:00
rebind_facet -> detail::fork_facet
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#define BOOST_OPENMETHOD_POLICY_HPP
|
||||
|
||||
#include <boost/openmethod/policies/basic_policy.hpp>
|
||||
|
||||
#include <boost/openmethod/policies/std_rtti.hpp>
|
||||
#include <boost/openmethod/policies/vptr_vector.hpp>
|
||||
#include <boost/openmethod/policies/basic_error_output.hpp>
|
||||
|
||||
@@ -21,6 +21,18 @@ namespace detail {
|
||||
using class_catalog = detail::static_list<detail::class_info>;
|
||||
using method_catalog = detail::static_list<detail::method_info>;
|
||||
|
||||
template<typename Policy, class Facet>
|
||||
struct fork_facet {
|
||||
using type = Facet;
|
||||
};
|
||||
|
||||
template<
|
||||
typename NewPolicy, typename OldPolicy,
|
||||
template<typename...> class GenericFacet, typename... Args>
|
||||
struct fork_facet<NewPolicy, GenericFacet<OldPolicy, Args...>> {
|
||||
using type = GenericFacet<NewPolicy, Args...>;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
namespace policies {
|
||||
@@ -55,12 +67,6 @@ struct error_output : facet {};
|
||||
struct trace_output : facet {};
|
||||
struct runtime_checks : facet {};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Facet implementations
|
||||
|
||||
struct debug;
|
||||
struct release;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// domain
|
||||
|
||||
@@ -86,18 +92,6 @@ vptr_type domain<Policy>::static_vptr;
|
||||
template<class Policy>
|
||||
std::vector<std::uintptr_t> domain<Policy>::dispatch_data;
|
||||
|
||||
template<typename Policy, class Facet>
|
||||
struct rebind_facet {
|
||||
using type = Facet;
|
||||
};
|
||||
|
||||
template<
|
||||
typename NewPolicy, typename OldPolicy,
|
||||
template<typename...> class GenericFacet, typename... Args>
|
||||
struct rebind_facet<NewPolicy, GenericFacet<OldPolicy, Args...>> {
|
||||
using type = GenericFacet<NewPolicy, Args...>;
|
||||
};
|
||||
|
||||
template<class Policy, class... Facets>
|
||||
struct basic_policy : abstract_policy, domain<Policy>, Facets... {
|
||||
using facets = mp11::mp_list<Facets...>;
|
||||
@@ -107,7 +101,7 @@ struct basic_policy : abstract_policy, domain<Policy>, Facets... {
|
||||
|
||||
template<class NewPolicy>
|
||||
using fork = basic_policy<
|
||||
NewPolicy, typename rebind_facet<NewPolicy, Facets>::type...>;
|
||||
NewPolicy, typename detail::fork_facet<NewPolicy, Facets>::type...>;
|
||||
|
||||
template<class... MoreFacets>
|
||||
using add = basic_policy<Policy, Facets..., MoreFacets...>;
|
||||
|
||||
@@ -306,7 +306,7 @@ struct key2;
|
||||
struct alt_rtti {};
|
||||
|
||||
static_assert(
|
||||
std::is_same_v<rebind_facet<key2, domain<key1>>::type, domain<key2>>);
|
||||
std::is_same_v<fork_facet<key2, domain<key1>>::type, domain<key2>>);
|
||||
|
||||
struct policy1 : basic_policy<policy1, std_rtti> {};
|
||||
struct policy2 : policy1::fork<policy2> {};
|
||||
|
||||
Reference in New Issue
Block a user