Allow inclusion of typeof.hpp for compilers (borland) that does not support typeof emulation or native typeof. For these compilers, BOOST_TYPEOF_EMULATION_UNSUPPORTED will be defined, and BOOST_TYPEOF(Expr) will always result in boost::type_of::typeof_emulation_is_unsupported_on_this_compiler

[SVN r63369]
This commit is contained in:
Peder Holt 2010-06-26 20:28:49 +00:00
parent dcb1e95d25
commit 468e0de51e
2 changed files with 49 additions and 3 deletions

23
include/boost/typeof/typeof.hpp Executable file → Normal file
View File

@ -65,7 +65,7 @@
# endif
# define BOOST_TYPEOF_KEYWORD __typeof__
# else
# error typeof emulation is not supported
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
# endif
# else // 9.x
# ifndef BOOST_TYPEOF_EMULATION
@ -75,7 +75,22 @@
# define BOOST_TYPEOF_KEYWORD __typeof__
# endif
# endif
#elif defined __CODEGEARC__
# ifndef BOOST_TYPEOF_EMULATION
# ifndef BOOST_TYPEOF_NATIVE
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
# endif
# else
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
# endif
#elif defined __BORLANDC__
# ifndef BOOST_TYPEOF_EMULATION
# ifndef BOOST_TYPEOF_NATIVE
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
# endif
# else
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
# endif
#elif defined __DMC__
# ifndef BOOST_TYPEOF_EMULATION
# ifndef BOOST_TYPEOF_NATIVE
@ -163,7 +178,9 @@
#define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
<boost/typeof/incr_registration_group.hpp>
#ifdef BOOST_TYPEOF_EMULATION
#ifdef BOOST_TYPEOF_EMULATION_UNSUPPORTED
# include <boost/typeof/unsupported.hpp>
#elif defined BOOST_TYPEOF_EMULATION
# define BOOST_TYPEOF_TEXT "using typeof emulation"
# include <boost/typeof/message.hpp>
# include <boost/typeof/typeof_impl.hpp>

View File

@ -0,0 +1,29 @@
// Copyright (C) 2010 Peder Holt
// 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_UNSUPPORTED_HPP_INCLUDED
#define BOOST_TYPEOF_UNSUPPORTED_HPP_INCLUDED
namespace boost { namespace type_of {
struct typeof_emulation_is_unsupported_on_this_compiler {};
}}
#define BOOST_TYPEOF(expr) boost::type_of::typeof_emulation_is_unsupported_on_this_compiler
#define BOOST_TYPEOF_TPL BOOST_TYPEOF
#define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
struct name {\
typedef BOOST_TYPEOF_TPL(expr) type;\
};
#define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
struct name {\
typedef BOOST_TYPEOF(expr) type;\
};
#define BOOST_TYPEOF_REGISTER_TYPE(x)
#define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params)
#endif