|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66130 - branches/release/boost/typeof
From: peder.holt_at_[hidden]
Date: 2010-10-21 05:34:16
Author: burbelgruff
Date: 2010-10-21 05:34:15 EDT (Thu, 21 Oct 2010)
New Revision: 66130
URL: http://svn.boost.org/trac/boost/changeset/66130
Log:
Integrated from trunk:
#4593 Type_of does not use BOOST_TYPEOF_EMULATION for VC10 and \Za
#3520 Syntax Error in boost/typeof/typeof.hpp
#4605 Make BOOST_TYPEOF_SILENT default
Apply variadic functions patch from Sergey Zubkovsky.
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
Properties modified:
branches/release/boost/typeof/message.hpp (contents, props changed)
branches/release/boost/typeof/register_functions.hpp (contents, props changed)
branches/release/boost/typeof/register_functions_iterate.hpp (contents, props changed)
branches/release/boost/typeof/typeof.hpp (contents, props changed)
Text files modified:
branches/release/boost/typeof/message.hpp | 2
branches/release/boost/typeof/register_functions.hpp | 19 ++++++++++-----
branches/release/boost/typeof/register_functions_iterate.hpp | 48 ++++++++++++++++++++++++++++++++++++++++
branches/release/boost/typeof/typeof.hpp | 44 ++++++++++++++++++++++++------------
4 files changed, 91 insertions(+), 22 deletions(-)
Modified: branches/release/boost/typeof/message.hpp
==============================================================================
--- branches/release/boost/typeof/message.hpp (original)
+++ branches/release/boost/typeof/message.hpp 2010-10-21 05:34:15 EDT (Thu, 21 Oct 2010)
@@ -2,7 +2,7 @@
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
-#if defined(_MSC_VER) && !defined BOOST_TYPEOF_SILENT
+#if defined(_MSC_VER) && defined BOOST_TYPEOF_MESSAGES
# pragma message(BOOST_TYPEOF_TEXT)
#endif
#undef BOOST_TYPEOF_TEXT
Modified: branches/release/boost/typeof/register_functions.hpp
==============================================================================
--- branches/release/boost/typeof/register_functions.hpp (original)
+++ branches/release/boost/typeof/register_functions.hpp 2010-10-21 05:34:15 EDT (Thu, 21 Oct 2010)
@@ -24,12 +24,19 @@
enum
{
FUN_ID = BOOST_TYPEOF_UNIQUE_ID(),
- FUN_PTR_ID = FUN_ID + 1 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
- FUN_REF_ID = FUN_ID + 2 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
- MEM_FUN_ID = FUN_ID + 3 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
- CONST_MEM_FUN_ID = FUN_ID + 4 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
- VOLATILE_MEM_FUN_ID = FUN_ID + 5 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
- VOLATILE_CONST_MEM_FUN_ID = FUN_ID + 6 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY)
+ FUN_PTR_ID = FUN_ID + 1 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ FUN_REF_ID = FUN_ID + 2 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ MEM_FUN_ID = FUN_ID + 3 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ CONST_MEM_FUN_ID = FUN_ID + 4 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ VOLATILE_MEM_FUN_ID = FUN_ID + 5 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ VOLATILE_CONST_MEM_FUN_ID = FUN_ID + 6 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ FUN_VAR_ID = FUN_ID + 7 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ FUN_VAR_PTR_ID = FUN_ID + 8 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ FUN_VAR_REF_ID = FUN_ID + 9 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ MEM_FUN_VAR_ID = FUN_ID + 10 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ CONST_MEM_FUN_VAR_ID = FUN_ID + 11 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ VOLATILE_MEM_FUN_VAR_ID = FUN_ID + 12 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
+ VOLATILE_CONST_MEM_FUN_VAR_ID = FUN_ID + 13 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY)
};
BOOST_TYPEOF_BEGIN_ENCODE_NS
Modified: branches/release/boost/typeof/register_functions_iterate.hpp
==============================================================================
--- branches/release/boost/typeof/register_functions_iterate.hpp (original)
+++ branches/release/boost/typeof/register_functions_iterate.hpp 2010-10-21 05:34:15 EDT (Thu, 21 Oct 2010)
@@ -15,6 +15,13 @@
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_PTR_ID + n) type;
};
+template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
+struct encode_type_impl<V, R(*)(BOOST_PP_ENUM_PARAMS(n, P) ...)>
+{
+ typedef R BOOST_PP_CAT(P, n);
+ typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_VAR_PTR_ID + n) type;
+};
+
template<class Iter>
struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
{
@@ -24,6 +31,15 @@
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
};
+template<class Iter>
+struct decode_type_impl<boost::mpl::size_t<FUN_VAR_PTR_ID + n>, Iter>
+{
+ typedef Iter iter0;
+ BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
+ typedef BOOST_PP_CAT(p, n)(*type)(BOOST_PP_ENUM_PARAMS(n, p) ...);
+ typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
+};
+
#ifndef BOOST_TYPEOF_NO_FUNCTION_TYPES
// function references
@@ -35,6 +51,13 @@
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_REF_ID + n) type;
};
+ template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
+ struct encode_type_impl<V, R(&)(BOOST_PP_ENUM_PARAMS(n, P) ...)>
+ {
+ typedef R BOOST_PP_CAT(P, n);
+ typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_VAR_REF_ID + n) type;
+ };
+
template<class Iter>
struct decode_type_impl<boost::mpl::size_t<FUN_REF_ID + n>, Iter>
{
@@ -44,6 +67,15 @@
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
};
+ template<class Iter>
+ struct decode_type_impl<boost::mpl::size_t<FUN_VAR_REF_ID + n>, Iter>
+ {
+ typedef Iter iter0;
+ BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
+ typedef BOOST_PP_CAT(p, n)(&type)(BOOST_PP_ENUM_PARAMS(n, p) ...);
+ typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
+ };
+
// functions
template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
@@ -53,6 +85,13 @@
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_ID + n) type;
};
+ template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
+ struct encode_type_impl<V, R(BOOST_PP_ENUM_PARAMS(n, P) ...)>
+ {
+ typedef R BOOST_PP_CAT(P, n);
+ typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_VAR_ID + n) type;
+ };
+
template<class Iter>
struct decode_type_impl<boost::mpl::size_t<FUN_ID + n>, Iter>
{
@@ -62,6 +101,15 @@
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
};
+ template<class Iter>
+ struct decode_type_impl<boost::mpl::size_t<FUN_VAR_ID + n>, Iter>
+ {
+ typedef Iter iter0;
+ BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
+ typedef BOOST_PP_CAT(p, n)(type)(BOOST_PP_ENUM_PARAMS(n, p) ...);
+ typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
+ };
+
#endif//BOOST_TYPEOF_NO_FUNCTION_TYPES
#ifndef BOOST_TYPEOF_NO_MEMBER_FUNCTION_TYPES
Modified: branches/release/boost/typeof/typeof.hpp
==============================================================================
--- branches/release/boost/typeof/typeof.hpp (original)
+++ branches/release/boost/typeof/typeof.hpp 2010-10-21 05:34:15 EDT (Thu, 21 Oct 2010)
@@ -15,7 +15,7 @@
#if defined(__COMO__)
# ifdef __GNUG__
-# ifndef(BOOST_TYPEOF_EMULATION)
+# ifndef BOOST_TYPEOF_EMULATION
# ifndef BOOST_TYPEOF_NATIVE
# define BOOST_TYPEOF_NATIVE
# endif
@@ -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
@@ -95,24 +110,21 @@
# else
# error typeof emulation is not supported
# endif
-# elif (_MSC_VER >= 1310) // 7.1, 8.0
+# elif (_MSC_VER >= 1310) // 7.1 ->
# ifndef BOOST_TYPEOF_EMULATION
# ifndef BOOST_TYPEOF_NATIVE
-# define BOOST_TYPEOF_NATIVE
+# ifndef _MSC_EXTENSIONS
+# define BOOST_TYPEOF_EMULATION
+# else
+# define BOOST_TYPEOF_NATIVE
+# endif
# endif
+# endif
+# ifdef BOOST_TYPEOF_NATIVE
# include <boost/typeof/msvc/typeof_impl.hpp>
# 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
-
#elif defined(__HP_aCC)
# ifndef BOOST_TYPEOF_NATIVE
# ifndef BOOST_TYPEOF_EMULATION
@@ -163,7 +175,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>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk