From b0934ae746393cfa38dacfdef6fede2060014b66 Mon Sep 17 00:00:00 2001 From: Nicola Musatti Date: Sun, 7 Oct 2007 20:10:53 +0000 Subject: [PATCH] Merge from trunk [SVN r39768] --- .../boost/typeof/template_template_param.hpp | 29 +++++++++++++--- include/boost/typeof/typeof.hpp | 2 +- include/boost/typeof/typeof_impl.hpp | 34 ++++++++++++++++++- 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/include/boost/typeof/template_template_param.hpp b/include/boost/typeof/template_template_param.hpp index 48f5c88..4d64190 100755 --- a/include/boost/typeof/template_template_param.hpp +++ b/include/boost/typeof/template_template_param.hpp @@ -93,10 +93,17 @@ namespace boost { namespace type_of { #define BOOST_TYPEOF_TYPEDEF_INT_PN(z,n,Params) typedef int BOOST_PP_CAT(P,n); +#ifdef __BORLANDC__ +#define BOOST_TYPEOF_DECODE_NESTED_TEMPLATE_HELPER_NAME BOOST_PP_CAT(\ + BOOST_PP_CAT(\ + BOOST_PP_CAT(\ + decode_nested_template_helper,\ + BOOST_TYPEOF_REGISTRATION_GROUP\ + ),0x10000\ + ),__LINE__\ + ) #define BOOST_TYPEOF_REGISTER_DECODE_NESTED_TEMPLATE_HELPER_IMPL(Name,Params,ID)\ - template<>\ - struct decode_nested_template_helper_impl >\ - {\ + struct BOOST_TYPEOF_DECODE_NESTED_TEMPLATE_HELPER_NAME {\ template\ struct decode_params;\ template\ @@ -105,12 +112,24 @@ namespace boost { namespace type_of { typedef Name type;\ };\ }; +//Template template param decoding +#define BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TEMPLATE_TYPE(Name,Params)\ + typedef typename BOOST_TYPEOF_DECODE_NESTED_TEMPLATE_HELPER_NAME::decode_params::type type; +#else +#define BOOST_TYPEOF_REGISTER_DECODE_NESTED_TEMPLATE_HELPER_IMPL(Name,Params,ID) //Template template param decoding #define BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TEMPLATE_TYPE(Name,Params)\ - typedef typename decode_nested_template_helper_impl::template decode_params::type type; - + template\ + struct decode_params;\ + template\ + struct decode_params\ + {\ + typedef Name type;\ + };\ + typedef typename decode_params::type type; +#endif #define BOOST_TYPEOF_REGISTER_DECLARE_DECODER_TYPE_PARAM_PAIR(z,n,elem) \ BOOST_TYPEOF_VIRTUAL(DECLARATION_TYPE, elem)(elem) BOOST_PP_CAT(T, n) diff --git a/include/boost/typeof/typeof.hpp b/include/boost/typeof/typeof.hpp index ca19115..165ef95 100755 --- a/include/boost/typeof/typeof.hpp +++ b/include/boost/typeof/typeof.hpp @@ -132,7 +132,7 @@ # endif #elif defined(__BORLANDC__) -# if (__BORLANDC__ < 0x600) +# if (__BORLANDC__ < 0x590) # define BOOST_TYPEOF_NO_FUNCTION_TYPES # define BOOST_TYPEOF_NO_MEMBER_FUNCTION_TYPES # endif diff --git a/include/boost/typeof/typeof_impl.hpp b/include/boost/typeof/typeof_impl.hpp index 4d9962a..d627b85 100755 --- a/include/boost/typeof/typeof_impl.hpp +++ b/include/boost/typeof/typeof_impl.hpp @@ -106,6 +106,38 @@ namespace boost { namespace type_of { typedef _typeof_encode_fraction fraction_type; #endif +#ifdef __BORLANDC__ +namespace boost { namespace type_of { + template + struct generic_typeof_fraction_iter { + typedef generic_typeof_fraction_iter self_t; + static const int pos=(Pos::value); + static const int iteration=(pos/5); + static const int where=pos%5; + typedef typename Iter::template _apply_next::type fraction_type; + typedef generic_typeof_fraction_iter next; + typedef typename v_iter >::type type; + }; +}} +#define BOOST_TYPEOF_NESTED_TYPEDEF_IMPL(expr) \ + template\ + struct _typeof_encode_fraction {\ + typedef _typeof_encode_fraction<_Typeof_Iteration> self_t;\ + BOOST_STATIC_CONSTANT(int,_typeof_encode_offset = (_Typeof_Iteration*BOOST_TYPEOF_LIMIT_SIZE));\ + typedef boost::type_of::offset_vector,boost::mpl::size_t > _typeof_start_vector;\ + BOOST_PP_REPEAT(BOOST_TYPEOF_LIMIT_SIZE,BOOST_TYPEOF_NESTED_TYPEITEM,expr)\ + template\ + struct _apply_next {\ + typedef _typeof_encode_fraction type;\ + };\ + };\ + template\ + struct _typeof_fraction_iter {\ + typedef boost::type_of::generic_typeof_fraction_iter > self_t;\ + typedef typename self_t::next next;\ + typedef typename self_t::type type;\ + }; +#else #define BOOST_TYPEOF_NESTED_TYPEDEF_IMPL(expr) \ template\ struct _typeof_encode_fraction {\ @@ -124,7 +156,7 @@ namespace boost { namespace type_of { typedef typename boost::type_of::v_iter >::type type;\ typedef _typeof_fraction_iter next;\ }; - +#endif #ifdef __MWERKS__ # define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \