diff --git a/include/boost/typeof/config.hpp b/include/boost/typeof/config.hpp deleted file mode 100755 index 9f3e57c..0000000 --- a/include/boost/typeof/config.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// 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_CONFIG_HPP_INCLUDED -#define BOOST_TYPEOF_CONFIG_HPP_INCLUDED - -#include -#include - -#if !defined(BOOST_TYPEOF_COMPLIANT) &&\ - !defined(BOOST_TYPEOF_NATIVE) - -# if defined __GNUC__ -# define BOOST_TYPEOF_NATIVE - -# elif defined __MWERKS__ -# define BOOST_TYPEOF_NATIVE - -# elif defined(BOOST_MSVC) && (BOOST_MSVC<1400) -//Doesn't require registration -# define BOOST_TYPEOF_NATIVE - -# else -# define BOOST_TYPEOF_COMPLIANT - -# endif - -#endif - -#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) -# define BOOST_TYPEOF_NO_SIMPLE_TYPE_OPTIMIZATION -#endif - -#endif//BOOST_TYPEOF_CONFIG_HPP_INCLUDED diff --git a/include/boost/typeof/template_encoding.hpp b/include/boost/typeof/template_encoding.hpp index c623086..d7b57c9 100755 --- a/include/boost/typeof/template_encoding.hpp +++ b/include/boost/typeof/template_encoding.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include diff --git a/include/boost/typeof/typeof.hpp b/include/boost/typeof/typeof.hpp index 66d9d3c..f95a13b 100755 --- a/include/boost/typeof/typeof.hpp +++ b/include/boost/typeof/typeof.hpp @@ -5,85 +5,148 @@ #ifndef BOOST_TYPEOF_TYPEOF_HPP_INCLUDED #define BOOST_TYPEOF_TYPEOF_HPP_INCLUDED -#include -#include -#include +#if defined(BOOST_TYPEOF_COMPLIANT) +# define BOOST_TYPEOF_EMULATION +#endif -// implementation +#if defined(BOOST_TYPEOF_EMULATION) && defined(BOOST_TYPEOF_NATIVE) +# error both typeof emulation and native mode requested +#endif -#include +#if defined(__COMO__) +# ifdef __GNUG__ +# ifndef(BOOST_TYPEOF_EMULATION) +# ifndef BOOST_TYPEOF_NATIVE +# define BOOST_TYPEOF_NATIVE +# endif +# define BOOST_TYPEOF_KEYWORD typeof +# endif +# else +# ifndef BOOST_TYPEOF_NATIVE +# ifndef BOOST_TYPEOF_EMULATION +# define BOOST_TYPEOF_EMULATION +# endif +# else +# error native typeof is not supported +# endif +# endif -// BOOST_TYPEOF, BOOST_TYPEOF_TPL +#elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) +# ifdef __GNUC__ +# ifndef BOOST_TYPEOF_EMULATION +# ifndef BOOST_TYPEOF_NATIVE +# define BOOST_TYPEOF_NATIVE +# endif +# define BOOST_TYPEOF_KEYWORD __typeof__ +# endif +# else +# ifndef BOOST_TYPEOF_NATIVE +# ifndef BOOST_TYPEOF_EMULATION +# define BOOST_TYPEOF_EMULATION +# endif +# else +# error native typeof is not supported +# endif +# endif -#if defined(BOOST_TYPEOF_NATIVE) && defined(BOOST_MSVC) -# define BOOST_TYPEOF_TEXT "using msvc 'native' imlementation" -# include -# include +#elif defined(__GNUC__) +# ifndef BOOST_TYPEOF_EMULATION +# ifndef BOOST_TYPEOF_NATIVE +# define BOOST_TYPEOF_NATIVE +# endif +# define BOOST_TYPEOF_KEYWORD __typeof__ +# endif -#elif defined(BOOST_TYPEOF_COMPLIANT) -# define BOOST_TYPEOF_TEXT "using compliant imlementation" -# include -# include +#elif defined(__MWERKS__) +# ifndef BOOST_TYPEOF_EMULATION +# ifndef BOOST_TYPEOF_NATIVE +# define BOOST_TYPEOF_NATIVE +# endif +# define BOOST_TYPEOF_KEYWORD __typeof__ +# endif -#else//BOOST_TYPEOF_NATIVE +#elif defined(_MSC_VER) +# if (_MSC_VER <= 1300) // 6.5, 7.0 +# ifndef BOOST_TYPEOF_EMULATION +# ifndef BOOST_TYPEOF_NATIVE +# define BOOST_TYPEOF_NATIVE +# endif +# include +# define MSVC_TYPEOF_HACK +# else +# error typeof emulation is not supported +# endif +# elif (_MSC_VER == 1310) // 7.1 +# ifndef BOOST_TYPEOF_EMULATION +# ifndef BOOST_TYPEOF_NATIVE +# define BOOST_TYPEOF_NATIVE +# endif +# include +# define MSVC_TYPEOF_HACK +# endif +# else // 8.0 +# ifndef BOOST_TYPEOF_NATIVE +# ifndef BOOST_TYPEOF_EMULATION +# define BOOST_TYPEOF_EMULATION +# endif +# else +# error native typeof is not supported +# endif +# endif -# define BOOST_TYPEOF_TEXT "using native imlementation" -# include - -# if !defined BOOST_TYPEOF_KEYWORD -# define BOOST_TYPEOF_KEYWORD typeof -# endif - - /* Native typeof can accept either type or value. - Something like "int()" can be viewed either way, but - typeof consideres it a type. We force it otherwise - to ensure consistensy with emulation */ - - namespace boost { namespace type_of { - template T& ensure_obj(const T&); - }} - -# define BOOST_TYPEOF(expr) BOOST_TYPEOF_KEYWORD(boost::type_of::ensure_obj(expr)) - -# define BOOST_TYPEOF_TPL BOOST_TYPEOF +#else //unknown compiler +# ifndef BOOST_TYPEOF_NATIVE +# ifndef BOOST_TYPEOF_EMULATION +# define BOOST_TYPEOF_EMULATION +# endif +# else +# ifndef BOOST_TYPEOF_KEYWORD +# define BOOST_TYPEOF_KEYWORD typeof +# endif +# endif #endif +#define BOOST_TYPEOF_UNIQUE_ID()\ + BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__ + +#define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\ + + +#ifdef BOOST_TYPEOF_EMULATION +# define BOOST_TYPEOF_TEXT "using typeof emulation" +# include +# include +# include +# include +# include +# include +# include + +#elif defined(BOOST_TYPEOF_NATIVE) +# define BOOST_TYPEOF_TEXT "using native typeof" +# ifndef MSVC_TYPEOF_HACK + + namespace boost { namespace type_of { + template T& ensure_obj(const T&); + }} + +# define BOOST_TYPEOF(expr) BOOST_TYPEOF_KEYWORD(boost::type_of::ensure_obj(expr)) +# define BOOST_TYPEOF_TPL BOOST_TYPEOF +# endif +# define BOOST_TYPEOF_REGISTER_TYPE(x) +# define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params) +#else +# error typeof configuration error +#endif + +#include + // auto #define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr #define BOOST_AUTO_TPL(Var, Expr) BOOST_TYPEOF_TPL(Expr) Var = Expr // lvalue typeof - -# include - -// type/template encoding - -#if defined(BOOST_TYPEOF_COMPLIANT) -# include -# include -#else //BOOST_TYPEOF_NATIVE -# define BOOST_TYPEOF_REGISTER_TYPE(x) -# define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params) -#endif - -#define BOOST_TYPEOF_UNIQUE_ID()\ - BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__ - -#define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\ - - -// register stuff -#include - -#if defined(BOOST_TYPEOF_COMPLIANT) - -# include -# include -# include - -#else //BOOST_TYPEOF_NATIVE - -#endif +#include #endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED