33
44#include < boost/openmethod/detail/static_list.hpp>
55
6+ #include < boost/config.hpp>
67#include < boost/mp11/algorithm.hpp>
78#include < boost/mp11/bind.hpp>
89#include < boost/preprocessor/cat.hpp>
@@ -738,8 +739,8 @@ struct TypeHashFn {
738739 // ! blueprint.
739740 // ! @return A pair containing the minimum and maximum hash values.
740741 template <class Context >
741- static auto initialize ( const Context& ctx)
742- -> std::pair<std::size_t, std::size_t>;
742+ static auto
743+ initialize ( const Context& ctx) -> std::pair<std::size_t , std::size_t >;
743744
744745 // ! Hash a `type_id`.
745746 // !
@@ -924,36 +925,34 @@ struct initialize_aux;
924925// -----------------------------------------------------------------------------
925926// attributes
926927
927- struct attributes {};
928- struct no_attributes : attributes {};
928+ struct attributes_base {};
929+
930+ struct no_attributes : attributes_base {};
931+
929932struct declspec {
930- struct dllexport : attributes {};
931- struct dllimport : attributes {};
933+ struct dllexport : attributes_base {};
934+ struct dllimport : attributes_base {};
932935};
933936
934- struct visibility {
935- struct hidden : attributes {};
936- struct default_ : attributes {};
937- };
938937namespace detail {
939938
940- #define BOOST_OPENMETHOD_DETAIL_MAKE_SYMBOL_WITH_ATTRIBUTES (ID ) \
939+ #define BOOST_OPENMETHOD_DETAIL_MAKE_SYMBOL_WITH_ATTRIBUTES (ID, ...) \
941940 template <class Type , class Guide = Type&, typename = void > \
942941 struct BOOST_PP_CAT (global_state_, ID) { \
943942 using attributes = no_attributes; \
944943 static Type ID; \
945944 }; \
946945 \
947946 template <class Type , class Guide , typename Enable> \
948- Type BOOST_PP_CAT (global_state_, ID)<Type, Guide, Enable>::ID; \
947+ Type BOOST_PP_CAT (global_state_, ID)<Type, Guide, Enable>::ID __VA_ARGS__; \
949948 \
950949 template <class Type , class Guide > \
951950 struct BOOST_PP_CAT (global_state_, ID)< \
952951 Type, Guide, \
953952 std::enable_if_t < \
954953 std::is_same_v<get_attributes<Guide>, declspec::dllexport>>> { \
955954 using attributes = declspec::dllexport; \
956- static __declspec (dllexport) Type ID; \
955+ static BOOST_SYMBOL_EXPORT Type ID __VA_ARGS__; \
957956 }; \
958957 \
959958 template <class Type , class Guide > \
@@ -968,7 +967,7 @@ namespace detail {
968967 std::enable_if_t < \
969968 std::is_same_v<get_attributes<Guide>, declspec::dllimport>>> { \
970969 using attributes = declspec::dllimport; \
971- static __declspec (dllimport) Type ID; \
970+ static BOOST_SYMBOL_IMPORT Type ID; \
972971 }
973972
974973template <typename Type>
@@ -1045,13 +1044,12 @@ struct attributes_guide final : attributes {
10451044// !
10461045// ! @see @ref policies
10471046template <class ... Policy>
1048- class registry
1049- : public detail::registry_base,
1050- public detail::global_state_st<
1051- detail::registry_state<registry<Policy...>>,
1052- typename detail::find_first_derived_of<
1053- policies::attributes, mp11::mp_list<Policy...>,
1054- policies::attributes_guide<registry<Policy...>>>::guide_type> {
1047+ class registry : public detail ::registry_base {
1048+ using storage = detail::global_state_st<
1049+ detail::registry_state<registry<Policy...>>,
1050+ typename detail::find_first_derived_of<
1051+ policies::attributes, mp11::mp_list<Policy...>,
1052+ policies::attributes_guide<registry<Policy...>>>::guide_type>;
10551053
10561054 template <class ...>
10571055 friend struct detail ::use_class_aux;
@@ -1061,6 +1059,11 @@ class registry
10611059 public:
10621060 // ! The type of this registry.
10631061 using registry_type = registry;
1062+ using attributes = typename storage::attributes;
1063+
1064+ static const void * id () {
1065+ return static_cast <const void *>(&storage::st);
1066+ }
10641067
10651068 template <class ... Options>
10661069 struct compiler ;
@@ -1170,7 +1173,7 @@ vptr_type registry<Policies...>::static_vptr;
11701173template <class ... Policies>
11711174void registry<Policies...>::require_initialized() {
11721175 if constexpr (registry::has_runtime_checks) {
1173- if (!st.initialized ) {
1176+ if (!storage:: st.initialized ) {
11741177 if constexpr (registry::has_error_handler) {
11751178 error_handler::error (not_initialized ());
11761179 }
0 commit comments