Re: Declaring overloads (and template functions).

Rene Rivera <[email protected]>
Newsgroups gmane.comp.lib.boost.langbinding
Organization Redshift Software, Inc.
Message-ID <[email protected]>
Roman Yakovenko wrote:
> On 7/26/07, Rene Rivera <[email protected]> wrote:
>> ===C++
>> class_<A>()
>>      .def("f", overload<void(int)>(&A::f))
>> ===
>>
>> Though, I'm not sure if one can make such an "overload<>()" function
>> smart enough to automatically turn the bare function type into the
>> corresponding member function pointer type.
> 
> I could be wrong but you can check this with boost::function library.
> http://boost.org/doc/html/function/tutorial.html#id1186900 .
> If that library can do this, than you can do it too.

That is equivalent to using is_member_function_pointer 
<http://boost.org/doc/html/boost_typetraits/reference.html#boost_typetraits.is_member_function_pointer>. 
The problems with those is that we don't have a member function pointer 
yet. To be clear the function might be declared as:

template <typename FunctionType, typename FunctionPointerType>
FunctionPointerType overload( FunctionPointerType p )
{
     return p;
}

The hard part is in calculating the FunctionPointerType such that 
FunctionType doesn't have include the "A::*" member pointer 
qualification. I personally dont't see a way of doing it :-(


-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.