Skip to content

Commit cdf2ab0

Browse files
committed
more policy splitting
1 parent 7fd449e commit cdf2ab0

File tree

6 files changed

+60
-47
lines changed

6 files changed

+60
-47
lines changed

include/yorel/yomm2/detail/compiler.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,32 @@ struct aggregate_reports;
3636

3737
template<class... Reports, class Facet, class... MoreFacets>
3838
struct aggregate_reports<
39-
boost::mp11::mp_list<Reports...>,
40-
boost::mp11::mp_list<Facet, MoreFacets...>,
39+
types<Reports...>,
40+
types<Facet, MoreFacets...>,
4141
std::void_t<typename Facet::report>> {
4242
using type = typename aggregate_reports<
43-
boost::mp11::mp_list<Reports..., typename Facet::report>,
44-
boost::mp11::mp_list<MoreFacets...>>::type;
43+
types<Reports..., typename Facet::report>,
44+
types<MoreFacets...>>::type;
4545
};
4646

4747
template<class... Reports, class Facet, class... MoreFacets, typename Void>
4848
struct aggregate_reports<
49-
boost::mp11::mp_list<Reports...>,
50-
boost::mp11::mp_list<Facet, MoreFacets...>, Void> {
49+
types<Reports...>,
50+
types<Facet, MoreFacets...>, Void> {
5151
using type = typename aggregate_reports<
52-
boost::mp11::mp_list<Reports...>,
53-
boost::mp11::mp_list<MoreFacets...>>::type;
52+
types<Reports...>,
53+
types<MoreFacets...>>::type;
5454
};
5555

5656
template<class... Reports, typename Void>
5757
struct aggregate_reports<
58-
boost::mp11::mp_list<Reports...>, boost::mp11::mp_list<>, Void> {
58+
types<Reports...>, types<>, Void> {
5959
struct type : Reports... {};
6060
};
6161

6262
template<class Policy>
6363
using report_type = typename aggregate_reports<
64-
boost::mp11::mp_list<update_report>, typename Policy::facets>::type;
64+
types<update_report>, typename Policy::facets>::type;
6565

6666
inline void merge_into(boost::dynamic_bitset<>& a, boost::dynamic_bitset<>& b) {
6767
if (b.size() < a.size()) {
@@ -229,7 +229,7 @@ struct compiler : generic_compiler {
229229
using type_index_type = decltype(Policy::type_index(0));
230230

231231
typename aggregate_reports<
232-
boost::mp11::mp_list<update_report>, typename Policy::facets>::type
232+
types<update_report>, typename Policy::facets>::type
233233
report;
234234

235235
std::unordered_map<type_index_type, class_*> class_map;

include/yorel/yomm2/detail/types.hpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#ifndef YOREL_YOMM2_DETAIL_TYPES_HPP
2+
#define YOREL_YOMM2_DETAIL_TYPES_HPP
3+
4+
#include <cstdint>
5+
#include <limits>
6+
7+
#if defined(YOMM2_SHARED)
8+
#if defined(_MSC_VER)
9+
#if !defined(yOMM2_API_msc)
10+
#define yOMM2_API_msc __declspec(dllimport)
11+
#endif
12+
#endif
13+
#endif
14+
15+
#if !defined(yOMM2_API_gcc)
16+
#define yOMM2_API_gcc
17+
#endif
18+
19+
#if !defined(yOMM2_API_msc)
20+
#define yOMM2_API_msc
21+
#endif
22+
23+
#define yOMM2_API yOMM2_API_gcc yOMM2_API_msc
24+
25+
namespace yorel {
26+
namespace yomm2 {
27+
28+
using type_id = std::uintptr_t;
29+
constexpr type_id invalid_type = (std::numeric_limits<type_id>::max)();
30+
31+
namespace detail {
32+
33+
template<typename... Types>
34+
struct types;
35+
36+
}
37+
} // namespace yomm2
38+
} // namespace yorel
39+
40+
#endif

include/yorel/yomm2/policies/core.hpp

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,14 @@
66
#ifndef YOREL_YOMM2_POLICIES_CORE_HPP
77
#define YOREL_YOMM2_POLICIES_CORE_HPP
88

9+
#include <yorel/yomm2/detail/types.hpp>
910
#include <yorel/yomm2/detail/static_list.hpp>
1011

1112
#include <boost/mp11/algorithm.hpp>
1213
#include <boost/mp11/bind.hpp>
1314

14-
#if defined(YOMM2_SHARED)
15-
#if defined(_MSC_VER)
16-
#if !defined(yOMM2_API_msc)
17-
#define yOMM2_API_msc __declspec(dllimport)
18-
#endif
19-
#endif
20-
#endif
21-
22-
#if !defined(yOMM2_API_gcc)
23-
#define yOMM2_API_gcc
24-
#endif
25-
26-
#if !defined(yOMM2_API_msc)
27-
#define yOMM2_API_msc
28-
#endif
29-
30-
#define yOMM2_API yOMM2_API_gcc yOMM2_API_msc
31-
32-
// -----------------------------------------------------------------------------
33-
// Forward declarations needed by "detail.hpp"
34-
3515
namespace yorel {
3616
namespace yomm2 {
37-
38-
struct context;
39-
struct catalog;
40-
41-
using type_id = std::uintptr_t;
42-
constexpr type_id invalid_type = (std::numeric_limits<type_id>::max)();
43-
4417
namespace detail {
4518

4619
// -----------------------------------------------------------------------------
@@ -217,7 +190,7 @@ template<class Policy, class... Facets>
217190
struct basic_policy : virtual abstract_policy,
218191
virtual basic_domain<Policy>,
219192
virtual Facets... {
220-
using facets = boost::mp11::mp_list<Facets...>;
193+
using facets = detail::types<Facets...>;
221194

222195
template<class Facet>
223196
static constexpr bool has_facet = std::is_base_of_v<Facet, Policy>;

include/yorel/yomm2/policies/std_rtti.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99

1010
#include <yorel/yomm2/policies/core.hpp>
1111

12+
#ifndef BOOST_NO_RTTI
13+
#include <typeindex>
14+
#include <typeinfo>
15+
#include <boost/core/demangle.hpp>
16+
#endif
17+
1218
namespace yorel {
1319
namespace yomm2 {
1420
namespace policy {

include/yorel/yomm2/policy.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
#include <variant>
1818
#include <vector>
1919

20-
#ifndef BOOST_NO_RTTI
21-
#include <typeindex>
22-
#include <typeinfo>
23-
#include <boost/core/demangle.hpp>
24-
#endif
25-
2620
#include <yorel/yomm2/policies/core.hpp>
2721

2822
#include <yorel/yomm2/detail.hpp>

include/yorel/yomm2/templates.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ using templates = types<template_<Templates>...>;
3232
namespace detail {
3333

3434
// template <template <typename...> typename... F>
35-
// using mp_list_q = boost::mp11::mp_list<boost::mp11::mp_quote<F>...>;
35+
// using mp_list_q = types<boost::mp11::mp_quote<F>...>;
3636

3737
template<typename...>
3838
struct product_impl;

0 commit comments

Comments
 (0)