// Copyright (C) 2004 Arkadiy Vertleyb // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_TYPEOF_TYPEOF_IMPL_HPP_INCLUDED #define BOOST_TYPEOF_TYPEOF_IMPL_HPP_INCLUDED #include #include #include #include #include #include #include #ifdef BOOST_TYPEOF_USE_MPL_VECTOR # include # include # define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::mpl::vector, n) #else # include # define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::type_of::vector, n) #endif namespace boost{namespace type_of{ template struct encode_result { typedef typename encode_type, T>::type encoded_type; typedef typename mpl::size::type size; #define BOOST_TYPEOF_ENCODE_INT(z,n,text)\ char(&BOOST_PP_CAT(value,n))[\ mpl::at<\ encoded_type,\ mpl::int_<(n < size::value) ? n : 0>\ >::type::value\ ]; BOOST_PP_REPEAT(BOOST_TYPEOF_LIMIT_SIZE,BOOST_TYPEOF_ENCODE_INT,_) #undef BOOST_TYPEOF_ENCODE_INT }; template encode_result typeof_result(const T&); }} #define BOOST_TYPEOF_AT(n, expr) sizeof(boost::type_of::typeof_result(expr).BOOST_PP_CAT(value,n)) # define BOOST_TYPEOF_TYPEITEM(z, n, expr)\ boost::mpl::size_t #define BOOST_TYPEOF(Expr) \ boost::type_of::decode_type< \ boost::mpl::begin< \ BOOST_TYPEOF_VECTOR(BOOST_TYPEOF_LIMIT_SIZE)< \ BOOST_PP_ENUM(BOOST_TYPEOF_LIMIT_SIZE, BOOST_TYPEOF_TYPEITEM, Expr) \ > \ >::type \ >::type #define BOOST_TYPEOF_TPL(Expr) \ typename boost::type_of::decode_type< \ typename boost::mpl::begin< \ BOOST_TYPEOF_VECTOR(BOOST_TYPEOF_LIMIT_SIZE)< \ BOOST_PP_ENUM(BOOST_TYPEOF_LIMIT_SIZE, BOOST_TYPEOF_TYPEITEM, Expr) \ > \ >::type \ >::type #endif//BOOST_TYPEOF_COMPLIANT_TYPEOF_IMPL_HPP_INCLUDED