Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70797 - branches/release/boost/ptr_container
From: nesotto_at_[hidden]
Date: 2011-03-31 16:36:46


Author: nesotto
Date: 2011-03-31 16:36:46 EDT (Thu, 31 Mar 2011)
New Revision: 70797
URL: http://svn.boost.org/trac/boost/changeset/70797

Log:
update from trunk to support decltype
Text files modified:
   branches/release/boost/ptr_container/indirect_fun.hpp | 34 ++++++++++++++++++++++++++--------
   1 files changed, 26 insertions(+), 8 deletions(-)

Modified: branches/release/boost/ptr_container/indirect_fun.hpp
==============================================================================
--- branches/release/boost/ptr_container/indirect_fun.hpp (original)
+++ branches/release/boost/ptr_container/indirect_fun.hpp 2011-03-31 16:36:46 EDT (Thu, 31 Mar 2011)
@@ -25,13 +25,23 @@
 #endif // BOOST_NO_SFINAE
 
 #include <boost/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_void.hpp>
 #include <functional>
 
 
 namespace boost
 {
 
-
+ namespace ptr_container_detail
+ {
+ template <typename Type, typename Dummy>
+ struct make_lazy
+ {
+ typedef typename Type::type type;
+ };
+ }
+
     template
     <
               class Fun
@@ -53,7 +63,7 @@
 #ifdef BOOST_NO_SFINAE
         Result
 #else
- BOOST_DEDUCED_TYPENAME result_of< Fun( BOOST_DEDUCED_TYPENAME pointee<T>::type& ) >::type
+ typename boost::result_of< const Fun( typename pointee<T>::type& ) >::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 boost::result_of< const Fun( typename pointee<T>::type&,
+ typename pointee<U>::type& ) >::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