From bc7af3a7e77d915b2bd06582c9da4fa7115f886e Mon Sep 17 00:00:00 2001 From: Peder Holt Date: Wed, 8 Jun 2005 06:09:09 +0000 Subject: [PATCH] Fixed problem with extra typename in BOOST_LVALUE_TYPEOF in native MSVC mode. [SVN r2614] --- include/boost/typeof/lvalue_typeof.hpp | 25 +++++++++++------------ include/boost/typeof/msvc/typeof_impl.hpp | 5 ++++- include/boost/typeof/typeof.hpp | 1 + include/boost/typeof/typeof_impl.hpp | 5 +++-- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/include/boost/typeof/lvalue_typeof.hpp b/include/boost/typeof/lvalue_typeof.hpp index fa3ec4e..9fe1b1c 100644 --- a/include/boost/typeof/lvalue_typeof.hpp +++ b/include/boost/typeof/lvalue_typeof.hpp @@ -7,6 +7,7 @@ #define BOOST_TYPEOF_LVALUE_TYPEOF_HPP_INCLUDED #include +#include namespace boost { @@ -76,17 +77,7 @@ namespace boost // Since this is always a type, // just add "typename" when using in templates -#ifndef BOOST_TYPEOF_COMPLIANT - -#define BOOST_LVALUE_TYPEOF(expr) \ - boost::type_of::decorate_type< \ - BOOST_TYPEOF(expr), \ - sizeof(*boost::type_of::classify_expression(expr)) \ - >::type - -#else //BOOST_TYPEOF_COMPLIANT - -#include +#if defined BOOST_TYPEOF_COMPLIANT || (defined(BOOST_TYPEOF_NATIVE) && defined(BOOST_MSVC)) namespace boost { namespace type_of { @@ -94,7 +85,7 @@ namespace boost { namespace type_of { struct decorate_decode_begin { typedef typename decorate_type< - typename decode_begin::type, + typename V::type, n >::type type; }; @@ -102,10 +93,18 @@ namespace boost { namespace type_of { #define BOOST_LVALUE_TYPEOF(expr) \ boost::type_of::decorate_decode_begin< \ - BOOST_TYPEOF_ENCODED_VECTOR(expr), \ + BOOST_TYPEOF_NO_TYPE(expr), \ sizeof(*boost::type_of::classify_expression(expr)) \ >::type #endif +#else //BOOST_TYPEOF_NATIVE + +#define BOOST_LVALUE_TYPEOF(expr) \ + boost::type_of::decorate_type< \ + BOOST_TYPEOF(expr), \ + sizeof(*boost::type_of::classify_expression(expr)) \ + >::type + #endif//BOOST_TYPEOF_LVALUE_TYPEOF_HPP_INCLUDED diff --git a/include/boost/typeof/msvc/typeof_impl.hpp b/include/boost/typeof/msvc/typeof_impl.hpp index 1769181..b57d210 100644 --- a/include/boost/typeof/msvc/typeof_impl.hpp +++ b/include/boost/typeof/msvc/typeof_impl.hpp @@ -148,8 +148,11 @@ namespace boost } } +# define BOOST_TYPEOF_NO_TYPE(expr) \ + boost::type_of::msvc_typeid_wrapper + # define BOOST_TYPEOF(expr) \ - boost::type_of::msvc_typeid_wrapper::type + BOOST_TYPEOF_NO_TYPE(expr)::type # define BOOST_TYPEOF_TPL(expr) typename BOOST_TYPEOF(expr) diff --git a/include/boost/typeof/typeof.hpp b/include/boost/typeof/typeof.hpp index 4429a6c..1523f91 100755 --- a/include/boost/typeof/typeof.hpp +++ b/include/boost/typeof/typeof.hpp @@ -47,6 +47,7 @@ # define BOOST_TYPEOF_TPL BOOST_TYPEOF + #endif // auto diff --git a/include/boost/typeof/typeof_impl.hpp b/include/boost/typeof/typeof_impl.hpp index 873d0ed..cdaaa28 100644 --- a/include/boost/typeof/typeof_impl.hpp +++ b/include/boost/typeof/typeof_impl.hpp @@ -51,8 +51,9 @@ namespace boost { namespace type_of { BOOST_PP_ENUM(BOOST_TYPEOF_LIMIT_SIZE, BOOST_TYPEOF_TYPEITEM, Expr) \ > -#define BOOST_TYPEOF(Expr)\ - boost::type_of::decode_begin::type +#define BOOST_TYPEOF_NO_TYPE(Expr)\ + boost::type_of::decode_begin +#define BOOST_TYPEOF(Expr) BOOST_TYPEOF_NO_TYPE(Expr)::type #define BOOST_TYPEOF_TPL typename BOOST_TYPEOF