Peter Soetens wrote:
On Friday 18 August 2006 08:34, Tobias Schwinger wrote:
Peter Soetens wrote:
On Saturday 12 August 2006 23:21, Tobias Schwinger wrote:
BTW: Not removing the class type (creating a function that takes the class context in form of a properly cv-qualified reference) is even simpler:
function_pointer<F>::type // is 'bool (*)(X &,int)' for F = 'bool (X::*)(int)' // is 'bool (*)(X const &,int)' for F = 'bool (X::*)(int) const'
Thanks, but I wanted the X& to be a pointer as well. OTOH, maybe I can change my code to pass a reference to X.
function_pointer<F>::type
is a shortcut for
function_pointer< components<F> >::type
and 'components' has a second template parameter, an MPL Lambda Expression, that allows to change the way the class type is transformed (and so has 'parameter_types'):
function_pointer< components< F, add_pointer<_> >::type // is 'bool (*)(X *,int)' for F = 'bool (X::*)(int)' // is 'bool (*)(X const *,int)' for F = 'bool (X::*)(int) const'
function_pointer< components< F, add_pointer< remove_cv<_> > >::type // is 'bool (*)(X *,int)' for F = 'bool (X::*)(int)' // is 'bool (*)(X *,int)' for F = 'bool (X::*)(int) const'
This is a complete killer-template. You are a genious.
Thanks. It's MPL that makes it possible, so I have to pass some of the fame to Aleksey. The review brought up the points that led to the current design so another portion goes to the reviewers...
If this becomes the 'look-and-feel' interface of the whole library (instead of the 'tags'), it will be an example for many other meta programming libraries.
Well there are still tags, but in many cases you don't have to care about
them. Further there are only "atomary" tags, that is they can be combined
by the user. Here are some example use cases:
function_pointer