Ticket #2676: djw_result_of_codegear.patch

File djw_result_of_codegear.patch, 6.5 KB (added by Joaquín M López Muñoz, 14 years ago)

Daniel Walker's patch

  • boost/utility/detail/result_of_iterate.hpp

     
    11// Boost result_of library
    22
    3 //  Copyright Douglas Gregor 2004. Use, modification and
     3//  Copyright Douglas Gregor and Daniel Walker 2004-2009. Use, modification and
    44//  distribution is subject to the Boost Software License, Version
    55//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
    66//  http://www.boost.org/LICENSE_1_0.txt)
     
    1010# error Boost result_of - do not include this file!
    1111#endif
    1212
    13 #if defined(BOOST_HAS_DECLTYPE)
     13#if (!defined(BOOST_HAS_DECLTYPE) \
     14     || BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)))
     15#  define BOOST_NO_ISO_RESULT_OF 1
     16#endif
    1417
     18#if !defined(BOOST_NO_ISO_RESULT_OF)
     19
    1520// As of N2588, C++0x result_of only supports function call
    1621// expressions of the form f(x). This precludes support for member
    1722// function pointers, which are invoked with expressions of the form
     
    4954
    5055} // namespace detail
    5156
    52 #else // defined(BOOST_HAS_DECLTYPE)
     57#else // !defined(BOOST_NO_ISO_RESULT_OF)
    5358
    5459// CWPro8 requires an argument in a function type specialization
    5560#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 0
  • boost/utility/result_of.hpp

     
    9292
    9393#else
    9494#  define BOOST_NO_RESULT_OF 1
     95#  define BOOST_NO_ISO_RESULT_OF 1
    9596#endif
    9697
    9798}
  • libs/utility/utility.htm

     
    154154                ...,t<em>N</em>)</code>. The implementation permits
    155155                the type <code>F</code> to be a function pointer,
    156156                function reference, member function pointer, or class
    157                 type.</p> <p>If your compiler does not support
    158                 <code>decltype</code>, then when <code>F</code> is a
     157                type.</p> <p>If your compiler cannot support the ISO
     158                draft specification of <code>result_of</code>,
     159                <a href="http://www.open-std.org/JTC1/sc22/wg21/docs/papers/2008/n2798.pdf">N2798</a> 20.7.4,
     160                then the macro <code>BOOST_NO_ISO_RESULT_OF</code> is
     161                defined, and the following protocol is followed to
     162                determine the type of call expressions.
     163                When <code>F</code> is a
    159164                class type with a member type <code>result_type</code>,
    160165                <code>result_of&lt;F(T1, T2, ...,
    161166                T<em>N</em>)&gt;</code> is
  • libs/utility/test/result_of_test.cpp

     
    11// Boost result_of library
    22
    3 //  Copyright Douglas Gregor 2003-2004. Use, modification and
     3//  Copyright Douglas Gregor and Daniel Walker 2003-2009. Use, modification and
    44//  distribution is subject to the Boost Software License, Version
    55//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
    66//  http://www.boost.org/LICENSE_1_0.txt)
     
    133133
    134134  // Prior to decltype, result_of could not deduce the return type
    135135  // nullary function objects unless they exposed a result_type.
    136 #if defined(BOOST_HAS_DECLTYPE)
     136#if defined(BOOST_NO_ISO_RESULT_OF)
     137  BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(void)>::type, void>::value));
     138  BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of(void)>::type, void>::value));
     139  BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(void)>::type, void>::value));
     140  BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of_template<void>(void)>::type, void>::value));
     141#else
    137142  BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(void)>::type, int>::value));
    138143  BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of(void)>::type, int>::value));
    139144  BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(void)>::type, int>::value));
    140145  BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of_template<void>(void)>::type, int>::value));
    141 #else
    142   BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(void)>::type, void>::value));
    143   BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of(void)>::type, void>::value));
    144   BOOST_STATIC_ASSERT((is_same<result_of<int_result_of_template<void>(void)>::type, void>::value));
    145   BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of_template<void>(void)>::type, void>::value));
    146146#endif
    147147
    148148  // Prior to decltype, result_of ignored a nested result<> if
    149149  // result_type was defined. After decltype, result_of deduces the
    150150  // actual return type of the function object, ignoring both
    151151  // result<> and result_type.
    152 #if defined(BOOST_HAS_DECLTYPE)
     152#if defined(BOOST_NO_ISO_RESULT_OF)
     153  BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, int>::value));
     154  BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, int>::value));
     155#else
    153156  BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, char>::value));
    154157  BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, char>::value));
    155 #else
    156   BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return(char)>::type, int>::value));
    157   BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of_and_char_return_template<void>(char)>::type, int>::value));
    158158#endif
    159159
    160160  BOOST_STATIC_ASSERT((is_same<result_of<func_ptr(char, float)>::type, int>::value));
     
    181181  BOOST_STATIC_ASSERT((is_same<result_of<pf_t(int)>::type, int>::value));
    182182  BOOST_STATIC_ASSERT((is_same<result_of<pf_t const(int)>::type,int>::value));
    183183
    184 #if defined(BOOST_HAS_DECLTYPE)
     184#if !defined(BOOST_NO_ISO_RESULT_OF)
    185185  BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(double)>::type, int>::value));
    186186  BOOST_STATIC_ASSERT((is_same<result_of<no_result_type_or_result_of(void)>::type, unsigned int>::value));
    187187  BOOST_STATIC_ASSERT((is_same<result_of<const no_result_type_or_result_of(double)>::type, short>::value));