Boost logo

Boost Users :

Subject: Re: [Boost-users] [function/bind] function object type introspection
From: AlfC (alfredo.correa_at_[hidden])
Date: 2009-10-02 12:55:32


> >  Is may be Boost.FunctionTypes what you are looking for?
> >http://www.boost.org/doc/libs/1_40_0/libs/function_types/doc/html/boo...
>
> It looks like right area, but i can't see how would I apply these.
>
> function_type expects mpl sequense.

Maybe what you need is a combinatioin of FunctionTypes and TypeTraits

//example with type_traits/function_traits
#include<boost/static_assert.hpp>
#include<boost/type_traits/function_traits.hpp>
struct newf : boost::function_traits<int(int,int)>{
         BOOST_STATIC_ASSERT(arity==2);
         result_type operator()(arg1_type a, arg2_type b){ //or
result_type operator()(first_argument_type a, second_argument_type b){
                return a+b;
         }
};


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net