Boost logo

Boost :

From: alnsn_at_[hidden]
Date: 2004-07-29 13:32:23


Daniel Wallin wrote:
> Please, no more trait blobs! IMO you should separate the traits into
> individual meta functions that works on all function pointer types. For
> instance:
>
> function_arity<T>::type
> Self explanatory.

I'm writing this adaptor again and again. Last time was 4 days ago.
If function_arity were in boost it could save a lot of my time :)

> function_signature<T>::type

Why metafunction? Function signature itself could be viewed as MPL
sequence (or view in MPL terms?):

  typedef argument_list<void (int)> args;
  static_assert(is_same<int,at_c<args,0>::type>);

or may be even more natural (because arguments usually are numbered
from 1):

  typedef result_and_arguments<void (int)> sig;
  static_assert(is_same<void,at_c<sig,0>::type>); // result
  static_assert(is_same<int, at_c<sig,1>::type>); // first arg

Conversion from *any* sequence to function signature could help in
back convertion.

-- 
Alexander Nasonov

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