Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

resolve.h

Go to the documentation of this file.
00001 /***
00002  * Copyright (c) 2005, SkeTo Project
00003  * All rights reserved.
00004  */
00011 #ifndef __RESOLVE_H__
00012 
00013 #define __RESOLVE_H__
00014 
00015 #include <utility>
00016 #include "functions.h"
00017 
00018 namespace skeleton {
00019   template< typename F >
00020   class resolving_function
00021     : public skeleton::binary_function< typename F::argument_type::first_type,
00022                     typename F::argument_type::second_type,
00023                     typename F::result_type >
00024   {
00025     F f;
00026   public:
00027     resolving_function( const F &f_ ) : f( f_ )
00028     { }
00029     typename F::result_type
00030     operator()( typename F::argument_type::first_type x,
00031         typename F::argument_type::second_type y ) const
00032     {
00033       return f( std::make_pair( x, y ) );
00034     }
00035   };
00036   
00037   template< typename F >
00038   class resolving_ptr_function
00039     : public skeleton::binary_ptr_function< typename F::first_argument_type,
00040                         typename F::second_argument_type::first_type,
00041                         typename F::second_argument_type::second_type >
00042   {
00043     F f;
00044   public:
00045     resolving_ptr_function( const F &f_ ) : f( f_ )
00046     { }
00047     void
00048     operator()( typename F::first_argument_type *r,
00049         const typename F::second_argument_type::first_type *x,
00050         const typename F::second_argument_type::second_type *y ) const
00051     {
00052       f( r, std::make_pair( x, y ) );
00053     }
00054   };
00055   
00056   template< typename F >
00057   inline skeleton::resolving_function< F >
00058   resolve_function( const F &f )
00059   {
00060     return skeleton::resolving_function< F >( f );
00061   }
00062   
00063   template< typename F >
00064   inline skeleton::resolving_ptr_function< F >
00065   resolve_ptr_function( const F &f )
00066   {
00067     return skeleton::resolving_ptr_function< F >( f );
00068   }
00069 }
00070 
00071 #endif // __RESOLVE_H__

Generated on Wed Jan 18 22:19:30 2006 for SkeTo -- Skeleton Library in Tokyo by  doxygen 1.4.4