Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69532 - trunk/boost/ptr_container
From: nesotto_at_[hidden]
Date: 2011-03-03 15:25:49


Author: nesotto
Date: 2011-03-03 15:25:49 EST (Thu, 03 Mar 2011)
New Revision: 69532
URL: http://svn.boost.org/trac/boost/changeset/69532

Log:
solved problem with result_of.
Text files modified:
   trunk/boost/ptr_container/indirect_fun.hpp | 36 +++++++++++++++++++++++++++---------
   1 files changed, 27 insertions(+), 9 deletions(-)

Modified: trunk/boost/ptr_container/indirect_fun.hpp
==============================================================================
--- trunk/boost/ptr_container/indirect_fun.hpp (original)
+++ trunk/boost/ptr_container/indirect_fun.hpp 2011-03-03 15:25:49 EST (Thu, 03 Mar 2011)
@@ -20,8 +20,9 @@
 
 #ifdef BOOST_NO_SFINAE
 #else
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_void.hpp>
 #include <boost/utility/result_of.hpp>
-#include <boost/pointee.hpp>
 #endif // BOOST_NO_SFINAE
 
 #include <boost/assert.hpp>
@@ -31,7 +32,15 @@
 namespace boost
 {
 
-
+ namespace ptr_container_detail
+ {
+ template <typename Type, typename Dummy>
+ struct make_lazy
+ {
+ typedef typename Type::type type;
+ };
+ }
+
     template
     <
               class Fun
@@ -53,7 +62,8 @@
 #ifdef BOOST_NO_SFINAE
         Result
 #else
- BOOST_DEDUCED_TYPENAME result_of< Fun( BOOST_DEDUCED_TYPENAME pointee<T>::type& ) >::type
+ typename ptr_container_detail::make_lazy<
+ boost::result_of<const Fun(const T&)>, T>::type
 #endif
         operator()( const T& r ) const
         {
@@ -64,8 +74,8 @@
 #ifdef BOOST_NO_SFINAE
         Result
 #else
- BOOST_DEDUCED_TYPENAME result_of< Fun( BOOST_DEDUCED_TYPENAME pointee<T>::type&,
- BOOST_DEDUCED_TYPENAME pointee<U>::type& ) >::type
+ typename ptr_container_detail::make_lazy<
+ boost::result_of<const Fun(const T&, const U&)>, T>::type
 #endif
         operator()( const T& r, const U& r2 ) const
         {
@@ -92,6 +102,7 @@
     class void_ptr_indirect_fun
     {
         Fun fun;
+
     public:
         
         void_ptr_indirect_fun() : fun(Fun())
@@ -99,24 +110,31 @@
 
         void_ptr_indirect_fun( Fun f ) : fun(f)
         { }
+
+ template< class Void >
 #ifdef BOOST_NO_SFINAE
         Result
 #else
- BOOST_DEDUCED_TYPENAME result_of< Fun( Arg1& ) >::type
+ typename ptr_container_detail::make_lazy<
+ boost::result_of<const Fun(const Arg1&)>, Void>::type
 #endif
- operator()( const void* r ) const
+ operator()( const Void* r ) const
         {
+ BOOST_STATIC_ASSERT(boost::is_void<Void>::value);
             BOOST_ASSERT( r != 0 );
             return fun( * static_cast<const Arg1*>( r ) );
         }
 
+ template< class Void >
 #ifdef BOOST_NO_SFINAE
         Result
 #else
- BOOST_DEDUCED_TYPENAME result_of< Fun( Arg1&, Arg2& ) >::type
+ typename ptr_container_detail::make_lazy<
+ boost::result_of<const Fun(const Arg1&, const Arg2&)>, Void>::type
 #endif
- operator()( const void* l, const void* r ) const
+ operator()( const Void* l, const Void* r ) const
         {
+ BOOST_STATIC_ASSERT(boost::is_void<Void>::value);
             BOOST_ASSERT( l != 0 && r != 0 );
             return fun( * static_cast<const Arg1*>( l ), * static_cast<const Arg2*>( r ) );
         }


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