From bde3c6cfa773c39c1858e2a909edbf2522b278a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sun, 5 Oct 2014 19:46:20 +0200 Subject: [PATCH] Avoid Boost.PP local iteration --- .../boost/intrusive/detail/memory_util.hpp | 185 +++++++++++++++--- 1 file changed, 153 insertions(+), 32 deletions(-) diff --git a/include/boost/intrusive/detail/memory_util.hpp b/include/boost/intrusive/detail/memory_util.hpp index fa261db..3d78b1a 100644 --- a/include/boost/intrusive/detail/memory_util.hpp +++ b/include/boost/intrusive/detail/memory_util.hpp @@ -27,10 +27,6 @@ #include #include -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -# include -#endif - namespace boost { namespace intrusive { namespace detail { @@ -101,7 +97,7 @@ struct LowPriorityConversion , ::boost::intrusive::detail::identity \ , ::boost::intrusive::detail::identity \ >::type::TNAME type; \ - }; \ + }; \ // #define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \ @@ -168,19 +164,93 @@ template struct first_param #else //C++03 compilers - #define BOOST_PP_LOCAL_MACRO(n) \ - template < template \ - class TemplateClass \ - , typename T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)> \ - struct first_param \ - < TemplateClass > \ - { \ - typedef T type; \ - }; \ - // - #define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS) - #include BOOST_PP_LOCAL_ITERATE() + template < template //0arg + class TemplateClass, class T + > + struct first_param + < TemplateClass > + { typedef T type; }; + + template < template //1arg + class TemplateClass, class T + , class P0> + struct first_param + < TemplateClass > + { typedef T type; }; + + template < template //2arg + class TemplateClass, class T + , class P0, class P1> + struct first_param + < TemplateClass > + { typedef T type; }; + + template < template //3arg + class TemplateClass, class T + , class P0, class P1, class P2> + struct first_param + < TemplateClass > + { typedef T type; }; + + template < template //4arg + class TemplateClass, class T + , class P0, class P1, class P2, class P3> + struct first_param + < TemplateClass > + { typedef T type; }; + + template < template //5arg + class TemplateClass, class T + , class P0, class P1, class P2, class P3, class P4> + struct first_param + < TemplateClass > + { typedef T type; }; + + template < template //6arg + class TemplateClass, class T + , class P0, class P1, class P2, class P3, class P4, class P5> + struct first_param + < TemplateClass > + { typedef T type; }; + + template < template //7arg + class TemplateClass, class T + , class P0, class P1, class P2, class P3, class P4, class P5, class P6> + struct first_param + < TemplateClass > + { typedef T type; }; + + template < template //8arg + class TemplateClass, class T + , class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7> + struct first_param + < TemplateClass > + { typedef T type; }; + + template < template //9arg + class TemplateClass, class T + , class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8> + struct first_param + < TemplateClass > + { typedef T type; }; + + template < template //10arg + class TemplateClass, class T + , class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9> + struct first_param + < TemplateClass > + { typedef T type; }; #endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) @@ -263,20 +333,71 @@ struct type_rebinder, U, 0u > #else //C++03 compilers -#define BOOST_PP_LOCAL_MACRO(n) \ -template < template \ - class Ptr \ - , typename T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ - , class U> \ -struct type_rebinder \ - < Ptr, U, 0u > \ -{ \ - typedef Ptr type; \ -}; \ -// -#define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS) -#include BOOST_PP_LOCAL_ITERATE() +template