From 4dd0e8023867348f9bcd91b075de23d1f8f02346 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leroy Date: Thu, 5 Feb 2015 01:41:03 -0500 Subject: [PATCH] yomm11_class::base_list -> type_list --- include/yorel/methods/extern_macros.hpp | 2 +- include/yorel/methods/macros.hpp | 8 ++++---- include/yorel/methods/no_macros.hpp | 23 +++++++++++++---------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/include/yorel/methods/extern_macros.hpp b/include/yorel/methods/extern_macros.hpp index 6d2a348..af51c0d 100644 --- a/include/yorel/methods/extern_macros.hpp +++ b/include/yorel/methods/extern_macros.hpp @@ -7,7 +7,7 @@ #undef YOMM11_CLASS #define YOMM11_CLASS(CLASS, BASES...) \ - using _yomm11_base_list = ::yorel::methods::detail::yomm11_class::base_list; \ + using _yomm11_base_list = ::yorel::methods::detail::type_list; \ const char* _yomm11_class_name_(CLASS*) { return #CLASS; } \ virtual void _yomm11_init_class_() diff --git a/include/yorel/methods/macros.hpp b/include/yorel/methods/macros.hpp index dd4245e..b0c2934 100644 --- a/include/yorel/methods/macros.hpp +++ b/include/yorel/methods/macros.hpp @@ -6,18 +6,18 @@ #undef MM_CLASS #define MM_CLASS(CLASS, ...) \ - using _yomm11_base_list = ::yorel::methods::detail::yomm11_class::base_list<__VA_ARGS__>; \ + using _yomm11_base_list = ::yorel::methods::detail::type_list<__VA_ARGS__>; \ YOMM11_TRACE(friend const char* _yomm11_name_(CLASS*) { return #CLASS; }) \ - virtual void _yomm11_init_class_() { &::yorel::methods::detail::yomm11_class::initializer>::the; } + virtual void _yomm11_init_class_() { &::yorel::methods::detail::yomm11_class::initializer>::the; } #undef MM_EXTERN_CLASS #define MM_EXTERN_CLASS(CLASS) #define MM_FOREIGN_CLASS(CLASS, ...) \ - static_assert(::yorel::methods::detail::check_bases>::value, "error in MM_FOREIGN_CLASS(): not a base in base list"); \ + static_assert(::yorel::methods::detail::check_bases>::value, "error in MM_FOREIGN_CLASS(): not a base in base list"); \ static_assert(std::is_polymorphic::value, "error: class must be polymorphic"); \ YOMM11_TRACE(const char* _yomm11_name_(CLASS*) { return #CLASS; }) \ - namespace { ::yorel::methods::detail::yomm11_class::initializer> _yomm11_add_class_ ## CLASS; } + namespace { ::yorel::methods::detail::yomm11_class::initializer> _yomm11_add_class_ ## CLASS; } #define MM_INIT() \ ::yorel::methods::detail::init_ptr<_yomm11_base_list>::init(this) diff --git a/include/yorel/methods/no_macros.hpp b/include/yorel/methods/no_macros.hpp index d5a7f9b..d694c7a 100644 --- a/include/yorel/methods/no_macros.hpp +++ b/include/yorel/methods/no_macros.hpp @@ -256,6 +256,9 @@ class bitvec { std::ostream& operator <<(std::ostream& os, const bitvec& v); +template +struct type_list; + struct yomm11_class { struct method_param { method_base* method; @@ -313,7 +316,7 @@ struct yomm11_class { struct initializer; template - struct initializer> { + struct initializer> { initializer(); static initializer the; }; @@ -534,10 +537,10 @@ template struct init_ptr; template -struct init_ptr> : init_ptr { }; +struct init_ptr> : init_ptr { }; template<> -struct init_ptr> { +struct init_ptr> { template static void init(This* p) { p->selector::_yomm11_ptbl = &yomm11_class::of::pc->mmt; } @@ -577,12 +580,12 @@ template struct check_bases; template -struct check_bases> { - static const bool value = std::is_base_of::value && check_bases>::value; +struct check_bases> { + static const bool value = std::is_base_of::value && check_bases>::value; }; template -struct check_bases> { +struct check_bases> { static const bool value = true; }; @@ -590,7 +593,7 @@ template struct has_nonvirtual_bases; template -struct has_nonvirtual_bases> : has_nonvirtual_bases{}; +struct has_nonvirtual_bases> : has_nonvirtual_bases{}; template struct has_nonvirtual_bases { @@ -848,9 +851,9 @@ std::ostream& operator <<(std::ostream& os, virtuals v){ #endif template -yomm11_class::initializer>::initializer() { +yomm11_class::initializer>::initializer() { static_assert( - detail::check_bases>::value, + detail::check_bases>::value, "Error in YOMM11_CLASS(): not a base in base list"); yomm11_class& pc = yomm11_class::of::the(); pc.abstract = std::is_abstract::value; @@ -865,7 +868,7 @@ yomm11_class::initializer>::initializer } template -yomm11_class::initializer> yomm11_class::initializer>::the; +yomm11_class::initializer> yomm11_class::initializer>::the; template class Method, typename R, typename... P> struct method {