Boost logo

Boost :

From: Falcon (boost_at_[hidden])
Date: 2005-06-17 15:53:35


I'd like to recommend the addition of code for handling of pointers to
member functions to Boost.Type_Traits. This is a simple modification,
but I am unaware of the ramifications on other compilers (Perhaps
someone else could shed some light on this?)
Since this is my first post here, please inform me if I did anything
wrong. :)

Peregrine Falcon

//// Original Code:

#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION

/*...*/

template<typename R>
struct function_traits_helper<R (*)(void)>
{
   BOOST_STATIC_CONSTANT(int, arity = 0);
   typedef R result_type;
};

/* etc. */

#else

/*...*/

template<typename R>
type_of_size<1> function_arity_helper(R (*f)());

/* etc. */

#endif

//// New code:

#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION

/*...*/

template<typename R, typename C>
struct function_traits_helper<R (C::*)(void)>
{
   BOOST_STATIC_CONSTANT(int, arity = 0);
   typedef R result_type;
   typedef C class_type;
};

/* etc. */

#else

/*...*/

template<typename R, typename C>
type_of_size<1> function_arity_helper(R (C::*f)());

/* etc. */

#endif


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk