Boost logo

Boost :

Subject: Re: [boost] Interest in Remote Procedure Call Library?
From: Daniel Larimer (dlarimer_at_[hidden])
Date: 2010-02-07 11:58:34


The macro system currently does not provide a way to handle "overloading" though I would love to hear your ideas on how to achieve it.

The macro currently generates something along the general idea of the code below only using a lot of "typeof" and other template tricks to automatically determine the signatures:

MetaClass
{
        class methodNameMeta
        {
                RTN operator( ARG, ... );
        }methodName;
        class anotherMethodMeta
        {
                RTN operator( ARG, ... );
        }anotherMethod;
}

Thus allowing the syntax:

MetaClass mc;
mc.methodName(...)

 Effectively I would need to define the operator() for each of the overloaded versions and thus I would need to get a member function pointer which would require the developer to specify more than just the method name in the TMETHOD() macro. So I suppose I could probably achieve it with the following syntax:

META_METHOD( CLassName,
        TMETHOD_OVERLOAD(methodName,
                        SIGNATURE( int (float) ),
                        SIGNATURE( void (float, float) ), ...
        )
)

As the code is currently written the TMETHOD() macro is relatively short and simply derives from a template base class based upon the arity, parameters, and class name. I would either need to adopt multiple inheritance or place more "real code" inside the macro.

So, to answer your question, it is possible though not as straight forward as the non-overloaded methods.

Thoughts?

Dan
 

On Feb 7, 2010, at 5:24 AM, vicente.botet wrote:

> Does the library takes care of overloading? Could you show an example?


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