From 6f0177d472f39c66de4e99e2714727d6bcf7e042 Mon Sep 17 00:00:00 2001 From: Peder Holt Date: Fri, 12 Nov 2004 23:10:57 +0000 Subject: [PATCH] Changes required for the integration process [SVN r2357] --- include/boost/typeof/vintage/config.hpp | 1 + ...{preserve_lvalue.hpp => lvalue_typeof.hpp} | 10 +-- .../vintage/register_functions_iterate.hpp | 80 +++++++++---------- .../typeof/vintage/template_encoding.hpp | 7 -- 4 files changed, 46 insertions(+), 52 deletions(-) rename include/boost/typeof/vintage/{preserve_lvalue.hpp => lvalue_typeof.hpp} (84%) diff --git a/include/boost/typeof/vintage/config.hpp b/include/boost/typeof/vintage/config.hpp index 249d9d2..f232082 100644 --- a/include/boost/typeof/vintage/config.hpp +++ b/include/boost/typeof/vintage/config.hpp @@ -3,6 +3,7 @@ // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) #include +#include #ifndef BOOST_TYPEOF_VINTAGE_CONFIG_HPP_INCLUDED #define BOOST_TYPEOF_VINTAGE_CONFIG_HPP_INCLUDED diff --git a/include/boost/typeof/vintage/preserve_lvalue.hpp b/include/boost/typeof/vintage/lvalue_typeof.hpp similarity index 84% rename from include/boost/typeof/vintage/preserve_lvalue.hpp rename to include/boost/typeof/vintage/lvalue_typeof.hpp index 252c45f..01ad457 100644 --- a/include/boost/typeof/vintage/preserve_lvalue.hpp +++ b/include/boost/typeof/vintage/lvalue_typeof.hpp @@ -2,8 +2,8 @@ // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_VINTAGE_PRESERVE_LVALUE_HPP_INCLUDED -#define BOOST_VINTAGE_PRESERVE_LVALUE_HPP_INCLUDED +#ifndef BOOST_VINTAGE_LVALUE_TYPEOF_HPP_INCLUDED +#define BOOST_VINTAGE_LVALUE_TYPEOF_HPP_INCLUDED #include @@ -59,11 +59,11 @@ namespace boost // Since this is always a type, // just add "typename" when using in templates -#define BOOST_TYPEOF_PRESERVE_LVALUE(expr) \ +#define BOOST_LVALUE_TYPEOF(expr) \ boost::type_of::decorate_type< \ BOOST_TYPEOF(expr), \ - sizeof(*boost::type_of::classify_expression(expr)) \ + sizeof(*boost::type_of::classify_expression(expr)) \ >::type -#endif //BOOST_VINTAGE_PRESERVE_LVALUE_HPP_INCLUDED +#endif //BOOST_VINTAGE_LVALUE_TYPEOF_HPP_INCLUDED \ No newline at end of file diff --git a/include/boost/typeof/vintage/register_functions_iterate.hpp b/include/boost/typeof/vintage/register_functions_iterate.hpp index 29baf84..1beba9a 100644 --- a/include/boost/typeof/vintage/register_functions_iterate.hpp +++ b/include/boost/typeof/vintage/register_functions_iterate.hpp @@ -4,6 +4,45 @@ #define n BOOST_PP_ITERATION() +template<> +struct encode_impl +{ + template + struct encoder { + typedef Types BOOST_PP_CAT(types_,n); + BOOST_PP_REPEAT(n,BOOST_TYPEOF_PUSH_FRONT,n) + BOOST_STATIC_CONSTANT(int,instantiate = + sizeof( + encode_modifier< + mpl::next::type, + R, + types_0 + >::encoded_type + ) + ); + friend sizer encode_value(const sizer&,const sizer&); + }; +}; + +template +typename encode_impl::template encoder +encode(R (& (*function)(V,Types))(BOOST_PP_ENUM_PARAMS(n,A)) ); + +template<> +struct decode_impl +{ + template + struct decoder { + typedef Iter iterR; + typedef decode_impl::decoder decodeR; + typedef typename decodeR::type R; + typedef typename decodeR::iter iter0; + BOOST_TYPEOF_DECODE_PARAMS(n); + typedef R (&type)(BOOST_PP_ENUM_PARAMS(n,A)); + typedef BOOST_PP_CAT(iter,n) iter; + }; +}; + template<> struct encode_impl { @@ -26,49 +65,10 @@ struct encode_impl template typename encode_impl::template encoder -encode(R (& (*function)(V,Types))(BOOST_PP_ENUM_PARAMS(n,A)) ); - -template<> -struct decode_impl -{ - template - struct decoder { - typedef Iter iterR; - typedef decode_impl::decoder decodeR; - typedef typename decodeR::type R; - typedef typename decodeR::iter iter0; - BOOST_TYPEOF_DECODE_PARAMS(n); - typedef R (&type)(BOOST_PP_ENUM_PARAMS(n,A)); - typedef BOOST_PP_CAT(iter,n) iter; - }; -}; - -template<> -struct encode_impl -{ - template - struct encoder { - typedef Types BOOST_PP_CAT(types_,n); - BOOST_PP_REPEAT(n,BOOST_TYPEOF_PUSH_FRONT,n) - BOOST_STATIC_CONSTANT(int,instantiate = - sizeof( - encode_modifier< - mpl::next::type, - R, - types_0 - >::encoded_type - ) - ); - friend sizer encode_value(const sizer&,const sizer&); - }; -}; - -template -typename encode_impl::template encoder encode(R (* const& (*function)(V,Types))(BOOST_PP_ENUM_PARAMS(n,A)) ); template<> -struct decode_impl +struct decode_impl { template struct decoder { diff --git a/include/boost/typeof/vintage/template_encoding.hpp b/include/boost/typeof/vintage/template_encoding.hpp index fc72e21..8d24071 100644 --- a/include/boost/typeof/vintage/template_encoding.hpp +++ b/include/boost/typeof/vintage/template_encoding.hpp @@ -79,11 +79,4 @@ namespace boost { namespace type_of{\ BOOST_TYPEOF_DECODE_TEMPLATE(template_type,seq)\ }}//namespace boost::type_of -#define BOOST_TYPEOF_REGISTER_TEMPLATE_TYPE_PARAM_(z, n, data) (typename) - -#define BOOST_TYPEOF_REGISTER_TEMPLATE(template_type, n)\ - BOOST_TYPEOF_REGISTER_TEMPLATE_X(template_type,\ - BOOST_PP_REPEAT(n, BOOST_TYPEOF_REGISTER_TEMPLATE_TYPE_PARAM_, ~)\ - ) - #endif //BOOST_VINTAGE_TEMPLATE_ENCODING_HPP_INCLUDED