Boost logo

Boost Users :

From: Stjepan Rajko (stipe_at_[hidden])
Date: 2008-02-06 13:04:49


On Feb 6, 2008 10:41 AM, Robert Dailey <rcdailey_at_[hidden]> wrote:
> On Feb 6, 2008 11:18 AM, Rene Rivera <grafikrobot_at_[hidden]> wrote:
> > You could use the new function_traits library, but that's not in a
> > release yet. Or recreate the type "manually" using the component
> > typedefs in function <http://boost.org/doc/html/boost/functionN.html>.
>
> I just created my own quick little class for this:
>
> template< typename t_fun >
> class FunctionHolder
> {
> public:
> typedef t_fun type;
> };
>
> I don't understand why boost::function can't just have the following:
>
> typedef Signature signature_type;
>
> It would be very useful!
>

If you're only using boost::function, you could do something along the lines of

template<typename T>
struct signature;

template<typename Signature, typename Allocator>
struct signature<boost::function<Signature, Allocator> >
{
  typedef Signature type;
}

// is_same<signature<boost::function<void (int)> >::type, void(int)>

If you're using boost::functionN classes directly, you'd have to
recreate it like Rene is suggesting.

Stjepan


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