X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=boost_ext%2Fboost%2Ftypeof%2Ftemplate_template_param.hpp;fp=boost_ext%2Fboost%2Ftypeof%2Ftemplate_template_param.hpp;h=3a26639ee2d37a0344e9b72dae4d0c88d0bd8b42;hb=4123b4fe58a7fd4659fa01476581690b47c83600;hp=0000000000000000000000000000000000000000;hpb=79564b90f6c9f7cd0bc5b11a6146bb7067b11a75;p=senf.git diff --git a/boost_ext/boost/typeof/template_template_param.hpp b/boost_ext/boost/typeof/template_template_param.hpp new file mode 100644 index 0000000..3a26639 --- /dev/null +++ b/boost_ext/boost/typeof/template_template_param.hpp @@ -0,0 +1,125 @@ +// Copyright (C) 2005 Peder Holt +// Copyright (C) 2005 Arkadiy Vertleyb +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPEOF_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED +#define BOOST_TYPEOF_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED + +#include +#include +#include + +#define BOOST_TYPEOF_MAKE_OBJ_template(x) BOOST_TYPEOF_TEMPLATE_PARAM(x) +#define BOOST_TYPEOF_TEMPLATE(X) template(X) BOOST_TYPEOF_EAT +#define BOOST_TYPEOF_template(X) (template(X)) + +#define BOOST_TYPEOF_TEMPLATE_PARAM(Params)\ + (TEMPLATE_PARAM)\ + (Params) + +#define BOOST_TYPEOF_TEMPLATE_PARAM_GETPARAMS(This)\ + BOOST_TYPEOF_TOSEQ(BOOST_PP_SEQ_ELEM(1, This)) + +//Encode / decode this +#define BOOST_TYPEOF_TEMPLATE_PARAM_ENCODE(This, n)\ + typedef typename boost::type_of::encode_template\ + >::type BOOST_PP_CAT(V, BOOST_PP_INC(n)); + +#define BOOST_TYPEOF_TEMPLATE_PARAM_DECODE(This, n)\ + typedef boost::type_of::decode_template< BOOST_PP_CAT(iter, n) > BOOST_PP_CAT(d, n);\ + typedef typename BOOST_PP_CAT(d, n)::type BOOST_PP_CAT(P, n);\ + typedef typename BOOST_PP_CAT(d, n)::iter BOOST_PP_CAT(iter,BOOST_PP_INC(n)); + +// template class +#define BOOST_TYPEOF_TEMPLATE_PARAM_EXPANDTYPE(This) \ + template class + +#define BOOST_TYPEOF_TEMPLATE_PARAM_PLACEHOLDER(Param)\ + Nested_Template_Template_Arguments_Not_Supported + +//'template class' is reduced to 'class' +#define BOOST_TYPEOF_TEMPLATE_PARAM_DECLARATION_TYPE(Param) class + +// T3 +#define BOOST_TYPEOF_TEMPLATE_PARAM_PLACEHOLDER_TYPES(Param, n)\ + BOOST_PP_CAT(T,n) + +#define BOOST_TYPEOF_TEMPLATE_PARAM_ISTEMPLATE 1 + +//////////////////////////// +// move to encode_decode? + +BOOST_TYPEOF_BEGIN_ENCODE_NS + +template struct encode_template_impl; +template struct decode_template_impl; + +BOOST_TYPEOF_END_ENCODE_NS + +namespace boost { namespace type_of { + + template struct encode_template + : BOOST_TYPEOF_ENCODE_NS_QUALIFIER::encode_template_impl + {}; + + template struct decode_template + : BOOST_TYPEOF_ENCODE_NS_QUALIFIER::decode_template_impl + {}; +}} + +//////////////////////////// +// move to template_encoding.hpp? + +//Template template registration +#define BOOST_TYPEOF_REGISTER_TYPE_FOR_TEMPLATE_TEMPLATE(Name,Params,ID)\ + template\ + struct encode_template_impl >\ + : boost::type_of::push_back >\ + {\ + };\ + template struct decode_template_impl, Iter>\ + {\ + BOOST_PP_REPEAT(BOOST_PP_SEQ_SIZE(Params),BOOST_TYPEOF_TYPEDEF_INT_PN,_)\ + typedef Name type;\ + typedef Iter iter;\ + }; + +#define BOOST_TYPEOF_TYPEDEF_INT_PN(z,n,Params) typedef int BOOST_PP_CAT(P,n); + +#define BOOST_TYPEOF_REGISTER_NOTHING(Name,Params,ID) + +//Template template param decoding +#define BOOST_TYPEOF_TYPEDEF_DECODED_TEMPLATE_TEMPLATE_TYPE(Name,Params)\ + template\ + struct decode_params;\ + template\ + struct decode_params\ + {\ + typedef Name type;\ + };\ + typedef typename decode_params::type type; + +#define BOOST_TYPEOF_REGISTER_DECLARE_DECODER_TYPE_PARAM_PAIR(z,n,elem) \ + BOOST_TYPEOF_VIRTUAL(DECLARATION_TYPE, elem)(elem) BOOST_PP_CAT(T, n) + +// BOOST_TYPEOF_HAS_TEMPLATES +#define BOOST_TYPEOF_HAS_TEMPLATES(Params)\ + BOOST_PP_SEQ_FOLD_LEFT(BOOST_TYPEOF_HAS_TEMPLATES_OP, 0, Params) + +#define BOOST_TYPEOF_HAS_TEMPLATES_OP(s, state, elem)\ + BOOST_PP_OR(state, BOOST_TYPEOF_VIRTUAL(ISTEMPLATE, elem)) + +//Define template template arguments +#define BOOST_TYPEOF_REGISTER_TEMPLATE_TEMPLATE_IMPL(Name,Params,ID)\ + BOOST_PP_IF(BOOST_TYPEOF_HAS_TEMPLATES(Params),\ + BOOST_TYPEOF_REGISTER_NOTHING,\ + BOOST_TYPEOF_REGISTER_TYPE_FOR_TEMPLATE_TEMPLATE)(Name,Params,ID) + +#endif //BOOST_TYPEOF_TEMPLATE_TEMPLATE_PARAM_HPP_INCLUDED