epoc32/include/stdapis/boost/ptr_container/indirect_fun.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/ptr_container/indirect_fun.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,133 @@
     1.4 +//
     1.5 +// Boost.Pointer Container
     1.6 +//
     1.7 +//  Copyright Thorsten Ottosen 2003-2005. Use, modification and
     1.8 +//  distribution is subject to the Boost Software License, Version
     1.9 +//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.10 +//  http://www.boost.org/LICENSE_1_0.txt)
    1.11 +//
    1.12 +// For more information, see http://www.boost.org/libs/ptr_container/
    1.13 +//
    1.14 +
    1.15 +#ifndef BOOST_PTR_CONTAINER_INDIRECT_FUN_HPP
    1.16 +#define BOOST_PTR_CONTAINER_INDIRECT_FUN_HPP
    1.17 +
    1.18 +#if defined(_MSC_VER) && (_MSC_VER >= 1200)
    1.19 +    #pragma once
    1.20 +#endif
    1.21 +
    1.22 +#include <boost/config.hpp>
    1.23 +
    1.24 +#ifdef BOOST_NO_SFINAE
    1.25 +#else
    1.26 +#include <boost/utility/result_of.hpp>
    1.27 +#include <boost/pointee.hpp>
    1.28 +#endif // BOOST_NO_SFINAE
    1.29 +
    1.30 +#include <boost/assert.hpp>
    1.31 +#include <functional>
    1.32 +
    1.33 +
    1.34 +namespace boost
    1.35 +{
    1.36 +
    1.37 +
    1.38 +    template
    1.39 +    < 
    1.40 +              class Fun
    1.41 +#ifdef BOOST_NO_SFINAE
    1.42 +            , class Result = bool
    1.43 +#endif        
    1.44 +    >
    1.45 +    class indirect_fun
    1.46 +    {
    1.47 +        Fun fun;
    1.48 +    public:
    1.49 +        indirect_fun() : fun(Fun())
    1.50 +        { }
    1.51 +        
    1.52 +        indirect_fun( Fun f ) : fun(f)
    1.53 +        { }
    1.54 +    
    1.55 +        template< class T >
    1.56 +#ifdef BOOST_NO_SFINAE
    1.57 +        Result    
    1.58 +#else            
    1.59 +        BOOST_DEDUCED_TYPENAME result_of< Fun( BOOST_DEDUCED_TYPENAME pointee<T>::type ) >::type 
    1.60 +#endif            
    1.61 +        operator()( const T& r ) const
    1.62 +        { 
    1.63 +            return fun( *r );
    1.64 +        }
    1.65 +    
    1.66 +        template< class T, class U >
    1.67 +#ifdef BOOST_NO_SFINAE
    1.68 +        Result    
    1.69 +#else                        
    1.70 +        BOOST_DEDUCED_TYPENAME result_of< Fun( BOOST_DEDUCED_TYPENAME pointee<T>::type, 
    1.71 +                                               BOOST_DEDUCED_TYPENAME pointee<U>::type ) >::type
    1.72 +#endif            
    1.73 +        operator()( const T& r, const U& r2 ) const
    1.74 +        { 
    1.75 +            return fun( *r, *r2 ); 
    1.76 +        }
    1.77 +    };
    1.78 +
    1.79 +    template< class Fun >
    1.80 +    inline indirect_fun<Fun> make_indirect_fun( Fun f )
    1.81 +    {
    1.82 +        return indirect_fun<Fun>( f );
    1.83 +    }
    1.84 +
    1.85 +
    1.86 +    template
    1.87 +    < 
    1.88 +        class Fun, 
    1.89 +        class Arg1, 
    1.90 +        class Arg2 = Arg1 
    1.91 +#ifdef BOOST_NO_SFINAE
    1.92 +      , class Result = bool   
    1.93 +#endif           
    1.94 +    >
    1.95 +    class void_ptr_indirect_fun
    1.96 +    {
    1.97 +        Fun fun;
    1.98 +    public:
    1.99 +        
   1.100 +        void_ptr_indirect_fun() : fun(Fun())
   1.101 +        { }
   1.102 +
   1.103 +        void_ptr_indirect_fun( Fun f ) : fun(f)
   1.104 +        { }
   1.105 +#ifdef BOOST_NO_SFINAE
   1.106 +        Result    
   1.107 +#else            
   1.108 +        BOOST_DEDUCED_TYPENAME result_of< Fun( Arg1 ) >::type 
   1.109 +#endif            
   1.110 +        operator()( const void* r ) const
   1.111 +        { 
   1.112 +            BOOST_ASSERT( r != 0 );
   1.113 +            return fun( * static_cast<const Arg1*>( r ) );
   1.114 +        }
   1.115 +
   1.116 +#ifdef BOOST_NO_SFINAE
   1.117 +        Result    
   1.118 +#else                    
   1.119 +        BOOST_DEDUCED_TYPENAME result_of< Fun( Arg1, Arg2 ) >::type 
   1.120 +#endif            
   1.121 +        operator()( const void* l, const void* r ) const
   1.122 +        { 
   1.123 +            BOOST_ASSERT( l != 0 && r != 0 );
   1.124 +            return fun( * static_cast<const Arg1*>( l ), * static_cast<const Arg2*>( r ) );
   1.125 +        }
   1.126 +    };
   1.127 +
   1.128 +    template< class Arg, class Fun >
   1.129 +    inline void_ptr_indirect_fun<Fun,Arg> make_void_ptr_indirect_fun( Fun f )
   1.130 +    {
   1.131 +        return void_ptr_indirect_fun<Fun,Arg>( f );
   1.132 +    }
   1.133 +     
   1.134 +} // namespace 'boost'
   1.135 +
   1.136 +#endif