Merge from trunk

[SVN r39768]
This commit is contained in:
Nicola Musatti
2007-10-07 20:10:53 +00:00
parent 6c8378110f
commit b0934ae746
3 changed files with 58 additions and 7 deletions

View File

@ -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<boost::mpl::size_t<ID> >\
{\
struct BOOST_TYPEOF_DECODE_NESTED_TEMPLATE_HELPER_NAME {\
template<BOOST_TYPEOF_SEQ_ENUM(Params,BOOST_TYPEOF_REGISTER_DECLARE_DECODER_TYPE_PARAM_PAIR) >\
struct decode_params;\
template<BOOST_TYPEOF_SEQ_ENUM(Params,BOOST_TYPEOF_REGISTER_DECODER_TYPE_PARAM_PAIR) >\
@ -105,12 +112,24 @@ namespace boost { namespace type_of {
typedef Name<BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(Params),T)> 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<BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(Params),P)>::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<self_id>::template decode_params<BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(Params),P)>::type type;
template<BOOST_TYPEOF_SEQ_ENUM(Params,BOOST_TYPEOF_REGISTER_DECLARE_DECODER_TYPE_PARAM_PAIR) >\
struct decode_params;\
template<BOOST_TYPEOF_SEQ_ENUM(Params,BOOST_TYPEOF_REGISTER_DECODER_TYPE_PARAM_PAIR) >\
struct decode_params<BOOST_TYPEOF_SEQ_ENUM(Params,BOOST_TYPEOF_PLACEHOLDER_TYPES) >\
{\
typedef Name<BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(Params),T)> type;\
};\
typedef typename decode_params<BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(Params),P)>::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)

View File

@ -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

View File

@ -106,6 +106,38 @@ namespace boost { namespace type_of {
typedef _typeof_encode_fraction<self_t::iteration> fraction_type;
#endif
#ifdef __BORLANDC__
namespace boost { namespace type_of {
template<typename Pos,typename Iter>
struct generic_typeof_fraction_iter {
typedef generic_typeof_fraction_iter<Pos,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<self_t::iteration>::type fraction_type;
typedef generic_typeof_fraction_iter<typename Pos::next,Iter> next;
typedef typename v_iter<fraction_type,mpl::int_<self_t::where> >::type type;
};
}}
#define BOOST_TYPEOF_NESTED_TYPEDEF_IMPL(expr) \
template<int _Typeof_Iteration>\
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_TYPEOF_VECTOR(0)<>,boost::mpl::size_t<self_t::_typeof_encode_offset> > _typeof_start_vector;\
BOOST_PP_REPEAT(BOOST_TYPEOF_LIMIT_SIZE,BOOST_TYPEOF_NESTED_TYPEITEM,expr)\
template<int Next>\
struct _apply_next {\
typedef _typeof_encode_fraction<Next> type;\
};\
};\
template<typename Pos>\
struct _typeof_fraction_iter {\
typedef boost::type_of::generic_typeof_fraction_iter<Pos,_typeof_encode_fraction<0> > self_t;\
typedef typename self_t::next next;\
typedef typename self_t::type type;\
};
#else
#define BOOST_TYPEOF_NESTED_TYPEDEF_IMPL(expr) \
template<int _Typeof_Iteration>\
struct _typeof_encode_fraction {\
@ -124,7 +156,7 @@ namespace boost { namespace type_of {
typedef typename boost::type_of::v_iter<fraction_type,boost::mpl::int_<self_t::where> >::type type;\
typedef _typeof_fraction_iter<typename Pos::next> next;\
};
#endif
#ifdef __MWERKS__
# define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \