Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62137 - in branches/release: . boost boost/algorithm/string boost/archive boost/bimap boost/config boost/config/compiler boost/detail boost/filesystem boost/functional/hash boost/fusion boost/gil boost/graph boost/integer boost/interprocess boost/intrusive boost/numeric/ublas boost/program_options boost/property_tree boost/python boost/regex boost/serialization boost/signals boost/signals2 boost/spirit boost/spirit/home boost/spirit/home/karma boost/spirit/home/support boost/system boost/thread boost/tr1 boost/type_traits boost/utility boost/utility/detail boost/uuid boost/variant boost/wave doc libs libs/array/doc libs/array/test libs/bimap libs/config libs/config/doc libs/filesystem libs/functional/hash libs/fusion libs/graph_parallel libs/integer libs/interprocess libs/intrusive libs/mpl/doc/refmanual libs/mpl/doc/src/refmanual libs/numeric/ublas libs/numeric/ublas/doc libs/property_tree libs/python libs/regex libs/regex/doc libs/serialization libs/signals libs/signals2 libs/spirit libs/spirit/classic/example libs/spirit/doc libs/spirit/example libs/spirit/phoenix libs/spirit/test libs/spirit/test/qi libs/static_assert libs/system libs/thread libs/timer libs/tr1 libs/type_traits libs/utility libs/utility/swap/test libs/utility/test libs/uuid libs/wave people status tools tools/bcp tools/boostbook tools/inspect tools/jam tools/quickbook tools/regression tools/release tools/wave wiki
From: eric_at_[hidden]
Date: 2010-05-22 01:35:53


Author: eric_niebler
Date: 2010-05-22 01:35:51 EDT (Sat, 22 May 2010)
New Revision: 62137
URL: http://svn.boost.org/trac/boost/changeset/62137

Log:
Merged revisions 61248 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r61248 | eric_niebler | 2010-04-13 08:01:11 -0700 (Tue, 13 Apr 2010) | 1 line
  
  add tr1_result_of that always behaves as TR1 specifies, fix Boost.TR1's result_of to use tr1_result_of
........

Properties modified:
   branches/release/ (props changed)
   branches/release/INSTALL (props changed)
   branches/release/LICENSE_1_0.txt (props changed)
   branches/release/boost/ (props changed)
   branches/release/boost-build.jam (props changed)
   branches/release/boost.css (props changed)
   branches/release/boost.png (props changed)
   branches/release/boost/algorithm/string/ (props changed)
   branches/release/boost/archive/ (props changed)
   branches/release/boost/array.hpp (props changed)
   branches/release/boost/bimap/ (props changed)
   branches/release/boost/config/ (props changed)
   branches/release/boost/config/compiler/ (props changed)
   branches/release/boost/detail/ (props changed)
   branches/release/boost/filesystem/ (props changed)
   branches/release/boost/functional/hash/ (props changed)
   branches/release/boost/fusion/ (props changed)
   branches/release/boost/gil/ (props changed)
   branches/release/boost/graph/ (props changed)
   branches/release/boost/integer/ (props changed)
   branches/release/boost/interprocess/ (props changed)
   branches/release/boost/intrusive/ (props changed)
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/program_options/ (props changed)
   branches/release/boost/property_tree/ (props changed)
   branches/release/boost/python/ (props changed)
   branches/release/boost/regex/ (props changed)
   branches/release/boost/serialization/ (props changed)
   branches/release/boost/serialization/factory.hpp (props changed)
   branches/release/boost/signals/ (props changed)
   branches/release/boost/signals2/ (props changed)
   branches/release/boost/spirit/ (props changed)
   branches/release/boost/spirit/home/ (props changed)
   branches/release/boost/spirit/home/karma/ (props changed)
   branches/release/boost/spirit/home/support/attributes.hpp (props changed)
   branches/release/boost/system/ (props changed)
   branches/release/boost/thread/ (props changed)
   branches/release/boost/thread.hpp (props changed)
   branches/release/boost/tr1/ (props changed)
   branches/release/boost/type_traits/ (props changed)
   branches/release/boost/utility/ (props changed)
   branches/release/boost/utility/value_init.hpp (props changed)
   branches/release/boost/uuid/ (props changed)
   branches/release/boost/variant/ (props changed)
   branches/release/boost/wave/ (props changed)
   branches/release/bootstrap.bat (props changed)
   branches/release/bootstrap.sh (props changed)
   branches/release/doc/ (props changed)
   branches/release/index.htm (props changed)
   branches/release/libs/ (props changed)
   branches/release/libs/array/doc/array.xml (props changed)
   branches/release/libs/array/test/array0.cpp (props changed)
   branches/release/libs/bimap/ (props changed)
   branches/release/libs/config/ (props changed)
   branches/release/libs/config/doc/ (props changed)
   branches/release/libs/filesystem/ (props changed)
   branches/release/libs/functional/hash/ (props changed)
   branches/release/libs/fusion/ (props changed)
   branches/release/libs/graph_parallel/ (props changed)
   branches/release/libs/integer/ (props changed)
   branches/release/libs/interprocess/ (props changed)
   branches/release/libs/intrusive/ (props changed)
   branches/release/libs/mpl/doc/refmanual/broken-compiler-workarounds.html (props changed)
   branches/release/libs/mpl/doc/refmanual/categorized-index-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/cfg-no-preprocessed-headers.html (props changed)
   branches/release/libs/mpl/doc/refmanual/composition-and-argument-binding.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-miscellaneous.html (props changed)
   branches/release/libs/mpl/doc/refmanual/extensible-associative-sequence.html (props changed)
   branches/release/libs/mpl/doc/refmanual/inserter-class.html (props changed)
   branches/release/libs/mpl/doc/refmanual/tag-dispatched-metafunction.html (props changed)
   branches/release/libs/mpl/doc/refmanual/trivial-metafunctions-summary.html (props changed)
   branches/release/libs/mpl/doc/src/refmanual/Iterators-Iterator.rst (props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/doc/ (props changed)
   branches/release/libs/property_tree/ (props changed)
   branches/release/libs/python/ (props changed)
   branches/release/libs/regex/ (props changed)
   branches/release/libs/regex/doc/ (props changed)
   branches/release/libs/serialization/ (props changed)
   branches/release/libs/signals/ (props changed)
   branches/release/libs/signals2/ (props changed)
   branches/release/libs/spirit/ (props changed)
   branches/release/libs/spirit/classic/example/ (props changed)
   branches/release/libs/spirit/doc/ (props changed)
   branches/release/libs/spirit/example/ (props changed)
   branches/release/libs/spirit/phoenix/ (props changed)
   branches/release/libs/spirit/test/ (props changed)
   branches/release/libs/spirit/test/qi/optional.cpp (props changed)
   branches/release/libs/static_assert/ (props changed)
   branches/release/libs/system/ (props changed)
   branches/release/libs/thread/ (props changed)
   branches/release/libs/timer/ (props changed)
   branches/release/libs/tr1/ (props changed)
   branches/release/libs/type_traits/ (props changed)
   branches/release/libs/utility/ (props changed)
   branches/release/libs/utility/swap.html (props changed)
   branches/release/libs/utility/swap/test/std_bitset.cpp (props changed)
   branches/release/libs/utility/value_init.htm (props changed)
   branches/release/libs/utility/value_init_test.cpp (props changed)
   branches/release/libs/uuid/ (props changed)
   branches/release/libs/wave/ (props changed)
   branches/release/people/ (props changed)
   branches/release/rst.css (props changed)
   branches/release/status/ (props changed)
   branches/release/status/Jamfile.v2 (props changed)
   branches/release/tools/ (props changed)
   branches/release/tools/bcp/ (props changed)
   branches/release/tools/boostbook/ (props changed)
   branches/release/tools/inspect/ (props changed)
   branches/release/tools/jam/ (props changed)
   branches/release/tools/quickbook/ (props changed)
   branches/release/tools/regression/ (props changed)
   branches/release/tools/release/ (props changed)
   branches/release/tools/wave/ (props changed)
   branches/release/wiki/ (props changed)
Text files modified:
   branches/release/boost/tr1/functional.hpp | 5
   branches/release/boost/utility/detail/result_of_iterate.hpp | 73 +++++++++++++++-
   branches/release/boost/utility/result_of.hpp | 24 ++++-
   branches/release/libs/utility/test/result_of_test.cpp | 171 +++++++++++++++++++++++++++++++++++++--
   4 files changed, 250 insertions(+), 23 deletions(-)

Modified: branches/release/boost/tr1/functional.hpp
==============================================================================
--- branches/release/boost/tr1/functional.hpp (original)
+++ branches/release/boost/tr1/functional.hpp 2010-05-22 01:35:51 EDT (Sat, 22 May 2010)
@@ -48,7 +48,10 @@
 
 namespace std{ namespace tr1{
 
- using ::boost::result_of;
+ template<class F>
+ struct result_of
+ : ::boost::tr1_result_of<F>
+ {};
 
 } }
 

Modified: branches/release/boost/utility/detail/result_of_iterate.hpp
==============================================================================
--- branches/release/boost/utility/detail/result_of_iterate.hpp (original)
+++ branches/release/boost/utility/detail/result_of_iterate.hpp 2010-05-22 01:35:51 EDT (Sat, 22 May 2010)
@@ -20,10 +20,69 @@
 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
 template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)>
+ : mpl::if_<
+ mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
+ , boost::detail::tr1_result_of_impl<
+ typename remove_cv<F>::type,
+ typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS),
+ (boost::detail::has_result_type<F>::value)>
+ , boost::detail::tr1_result_of_impl<
+ F,
+ F(BOOST_RESULT_OF_ARGS),
+ (boost::detail::has_result_type<F>::value)> >::type { };
+#endif
+
+#if !defined(BOOST_NO_DECLTYPE) && defined(BOOST_RESULT_OF_USE_DECLTYPE)
+
+// As of N2588, C++0x result_of only supports function call
+// expressions of the form f(x). This precludes support for member
+// function pointers, which are invoked with expressions of the form
+// o->*f(x). This implementation supports both.
+template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
+ : mpl::if_<
+ mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
+ , detail::tr1_result_of_impl<
+ typename remove_cv<F>::type,
+ typename remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
+ >
+ , detail::cpp0x_result_of_impl<
+ F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))
+ >
+ >::type
+{};
+
+namespace detail {
+
+# define BOOST_RESULT_OF_STATIC_MEMBERS(z, n, _) \
+ static T ## n t ## n; \
+ /**/
+
+template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
+class cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
+{
+ static F f;
+ BOOST_PP_REPEAT(BOOST_PP_ITERATION(), BOOST_RESULT_OF_STATIC_MEMBERS, _)
+public:
+ typedef decltype(f(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),t))) type;
+};
+
+} // namespace detail
+
+#else // defined(BOOST_NO_DECLTYPE)
+
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
 struct result_of<F(BOOST_RESULT_OF_ARGS)>
- : boost::detail::result_of_impl<F, F(BOOST_RESULT_OF_ARGS), (boost::detail::has_result_type<F>::value)> {};
+ : tr1_result_of<F(BOOST_RESULT_OF_ARGS)> { };
 #endif
 
+#endif // defined(BOOST_NO_DECLTYPE)
+
 #undef BOOST_RESULT_OF_ARGS
 
 #if BOOST_PP_ITERATION() >= 1
@@ -32,14 +91,14 @@
 
 template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
+struct tr1_result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
 {
   typedef R type;
 };
 
 template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
+struct tr1_result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
 {
   typedef R type;
 };
@@ -47,7 +106,7 @@
 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
 template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (T0::*)
+struct tr1_result_of_impl<R (T0::*)
                      (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)),
                  FArgs, false>
 {
@@ -56,7 +115,7 @@
 
 template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (T0::*)
+struct tr1_result_of_impl<R (T0::*)
                      (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
                      const,
                  FArgs, false>
@@ -66,7 +125,7 @@
 
 template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (T0::*)
+struct tr1_result_of_impl<R (T0::*)
                      (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
                      volatile,
                  FArgs, false>
@@ -76,7 +135,7 @@
 
 template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (T0::*)
+struct tr1_result_of_impl<R (T0::*)
                      (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
                      const volatile,
                  FArgs, false>

Modified: branches/release/boost/utility/result_of.hpp
==============================================================================
--- branches/release/boost/utility/result_of.hpp (original)
+++ branches/release/boost/utility/result_of.hpp 2010-05-22 01:35:51 EDT (Sat, 22 May 2010)
@@ -10,13 +10,18 @@
 #define BOOST_RESULT_OF_HPP
 
 #include <boost/config.hpp>
-#include <boost/type_traits/ice.hpp>
-#include <boost/type.hpp>
-#include <boost/preprocessor.hpp>
+#include <boost/preprocessor/iteration/iterate.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
 #include <boost/detail/workaround.hpp>
 #include <boost/mpl/has_xxx.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/bool.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/is_member_function_pointer.hpp>
+#include <boost/type_traits/remove_cv.hpp>
 
 #ifndef BOOST_RESULT_OF_NUM_ARGS
 # define BOOST_RESULT_OF_NUM_ARGS 10
@@ -25,13 +30,15 @@
 namespace boost {
 
 template<typename F> struct result_of;
+template<typename F> struct tr1_result_of; // a TR1-style implementation of result_of
 
 #if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
 namespace detail {
 
 BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
 
-template<typename F, typename FArgs, bool HasResultType> struct result_of_impl;
+template<typename F, typename FArgs, bool HasResultType> struct tr1_result_of_impl;
+template<typename F> struct cpp0x_result_of_impl;
 
 template<typename F>
 struct result_of_void_impl
@@ -51,8 +58,13 @@
   typedef R type;
 };
 
+// Determine the return type of a function pointer or pointer to member.
 template<typename F, typename FArgs>
-struct result_of_impl<F, FArgs, true>
+struct result_of_pointer
+ : tr1_result_of_impl<typename remove_cv<F>::type, FArgs, false> { };
+
+template<typename F, typename FArgs>
+struct tr1_result_of_impl<F, FArgs, true>
 {
   typedef typename F::result_type type;
 };
@@ -68,7 +80,7 @@
 {};
 
 template<typename F, typename FArgs>
-struct result_of_impl<F, FArgs, false>
+struct tr1_result_of_impl<F, FArgs, false>
   : mpl::if_<is_function_with_no_args<FArgs>,
              result_of_void_impl<F>,
              result_of_nested_result<F, FArgs> >::type

Modified: branches/release/libs/utility/test/result_of_test.cpp
==============================================================================
--- branches/release/libs/utility/test/result_of_test.cpp (original)
+++ branches/release/libs/utility/test/result_of_test.cpp 2010-05-22 01:35:51 EDT (Sat, 22 May 2010)
@@ -5,41 +5,109 @@
 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+#define BOOST_RESULT_OF_USE_DECLTYPE
+
 // For more information, see http://www.boost.org/libs/utility
 #include <boost/utility/result_of.hpp>
 #include <utility>
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/is_same.hpp>
 
-struct int_result_type { typedef int result_type; };
+struct int_result_type
+{
+ typedef int result_type;
+ result_type operator()(float);
+};
 
 struct int_result_of
 {
   template<typename F> struct result { typedef int type; };
+ result<int_result_of(double)>::type operator()(double);
+ result<const int_result_of(double)>::type operator()(double) const;
+ result<int_result_of()>::type operator()();
+ result<volatile int_result_of()>::type operator()() volatile;
 };
 
-struct int_result_type_and_float_result_of
+struct int_result_type_and_float_result_of_and_char_return
 {
   typedef int result_type;
   template<typename F> struct result { typedef float type; };
+ char operator()(char);
 };
 
 template<typename T>
-struct int_result_type_template { typedef int result_type; };
+struct int_result_type_template
+{
+ typedef int result_type;
+ result_type operator()(float);
+};
 
 template<typename T>
 struct int_result_of_template
 {
   template<typename F> struct result;
   template<typename This, typename That> struct result<This(That)> { typedef int type; };
+ typename result<int_result_of_template<T>(double)>::type operator()(double);
+ typename result<const int_result_of_template<T>(double)>::type operator()(double) const;
+ typename result<int_result_of_template<T>(double)>::type operator()();
+ typename result<volatile int_result_of_template<T>(double)>::type operator()() volatile;
 };
 
 template<typename T>
-struct int_result_type_and_float_result_of_template
+struct int_result_type_and_float_result_of_and_char_return_template
 {
   typedef int result_type;
   template<typename F> struct result;
   template<typename This, typename That> struct result<This(That)> { typedef float type; };
+ char operator()(char);
+};
+
+struct result_of_member_function_template
+{
+ template<typename F> struct result;
+
+ template<typename This, typename That> struct result<This(That)> { typedef That type; };
+ template<class T> typename result<result_of_member_function_template(T)>::type operator()(T);
+
+ template<typename This, typename That> struct result<const This(That)> { typedef const That type; };
+ template<class T> typename result<const result_of_member_function_template(T)>::type operator()(T) const;
+
+ template<typename This, typename That> struct result<volatile This(That)> { typedef volatile That type; };
+ template<class T> typename result<volatile result_of_member_function_template(T)>::type operator()(T) volatile;
+
+ template<typename This, typename That> struct result<const volatile This(That)> { typedef const volatile That type; };
+ template<class T> typename result<const volatile result_of_member_function_template(T)>::type operator()(T) const volatile;
+
+ template<typename This, typename That> struct result<This(That &, That)> { typedef That & type; };
+ template<class T> typename result<result_of_member_function_template(T &, T)>::type operator()(T &, T);
+
+ template<typename This, typename That> struct result<This(That const &, That)> { typedef That const & type; };
+ template<class T> typename result<result_of_member_function_template(T const &, T)>::type operator()(T const &, T);
+
+ template<typename This, typename That> struct result<This(That volatile &, That)> { typedef That volatile & type; };
+ template<class T> typename result<result_of_member_function_template(T volatile &, T)>::type operator()(T volatile &, T);
+
+ template<typename This, typename That> struct result<This(That const volatile &, That)> { typedef That const volatile & type; };
+ template<class T> typename result<result_of_member_function_template(T const volatile &, T)>::type operator()(T const volatile &, T);
+};
+
+struct no_result_type_or_result_of
+{
+ int operator()(double);
+ short operator()(double) const;
+ unsigned int operator()();
+ unsigned short operator()() volatile;
+ const unsigned short operator()() const volatile;
+};
+
+template<typename T>
+struct no_result_type_or_result_of_template
+{
+ int operator()(double);
+ short operator()(double) const;
+ unsigned int operator()();
+ unsigned short operator()() volatile;
+ const unsigned short operator()() const volatile;
 };
 
 struct X {};
@@ -60,16 +128,52 @@
 
   BOOST_STATIC_ASSERT((is_same<result_of<int_result_type(float)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(double)>::type, int>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(void)>::type, void>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<const int_result_of(double)>::type, int>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of(void)>::type, void>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of(char)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_template<void>(float)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(double)>::type, int>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(void)>::type, void>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<const int_result_of_template<void>(double)>::type, int>::value));
+
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type(float)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_of(double)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<const int_result_of(double)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type_template<void>(float)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_of_template<void>(double)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<const int_result_of_template<void>(double)>::type, int>::value));
+
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_of(void)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<volatile int_result_of(void)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_of_template<void>(void)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<volatile int_result_of_template<void>(void)>::type, void>::value));
+
+ // Prior to decltype, result_of could not deduce the return type
+ // nullary function objects unless they exposed a result_type.
+#if !defined(BOOST_NO_DECLTYPE)
+ BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(void)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of(void)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(void)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of_template<void>(void)>::type, int>::value));
+#else
+ BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(void)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of(void)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(void)>::type, void>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of_template<void>(void)>::type, void>::value));
- BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_template<void>(char)>::type, int>::value));
+#endif
+
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, int>::value));
+
+ // Prior to decltype, result_of ignored a nested result<> if
+ // result_type was defined. After decltype, result_of deduces the
+ // actual return type of the function object, ignoring both
+ // result<> and result_type.
+#if !defined(BOOST_NO_DECLTYPE)
+ BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, char>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, char>::value));
+#else
+ BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, int>::value));
+#endif
+
   BOOST_STATIC_ASSERT((is_same<result_of<func_ptr(char, float)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<func_ref(char, float)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<func_ptr_0()>::type, int>::value));
@@ -81,5 +185,54 @@
   BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_0(X)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<func_ptr(void)>::type, int>::value));
 
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr(char, float)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref(char, float)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr_0()>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref_0()>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr(X,char)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_c(X,char)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_v(X,char)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_cv(X,char)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_0(X)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr(void)>::type, int>::value));
+
+ BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(double)>::type, double>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const result_of_member_function_template(double)>::type, const double>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<volatile result_of_member_function_template(double)>::type, volatile double>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const volatile result_of_member_function_template(double)>::type, const volatile double>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int &, int)>::type, int &>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int const &, int)>::type, int const &>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int volatile &, int)>::type, int volatile &>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<result_of_member_function_template(int const volatile &, int)>::type, int const volatile &>::value));
+
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(double)>::type, double>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<const result_of_member_function_template(double)>::type, const double>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<volatile result_of_member_function_template(double)>::type, volatile double>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<const volatile result_of_member_function_template(double)>::type, const volatile double>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(int &, int)>::type, int &>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(int const &, int)>::type, int const &>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(int volatile &, int)>::type, int volatile &>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<result_of_member_function_template(int const volatile &, int)>::type, int const volatile &>::value));
+
+ typedef int (*pf_t)(int);
+ BOOST_STATIC_ASSERT((is_same<result_of<pf_t(int)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<pf_t const(int)>::type,int>::value));
+
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<pf_t(int)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<pf_t const(int)>::type,int>::value));
+
+#if !defined(BOOST_NO_DECLTYPE)
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(double)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(void)>::type, unsigned int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const no_result_type_or_result_of(double)>::type, short>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<volatile no_result_type_or_result_of(void)>::type, unsigned short>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const volatile no_result_type_or_result_of(void)>::type, const unsigned short>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of_template<void>(double)>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of_template<void>(void)>::type, unsigned int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const no_result_type_or_result_of_template<void>(double)>::type, short>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<volatile no_result_type_or_result_of_template<void>(void)>::type, unsigned short>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<const volatile no_result_type_or_result_of_template<void>(void)>::type, const unsigned short>::value));
+#endif
+
   return 0;
 }


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