[C++-sig] Generic Function Calls

Stefan Seefeld seefeld at sympatico.ca
Sat Aug 2 16:59:05 CEST 2008


William Marié wrote:
> Hi,
>
> I'm using Boost Python and i would like to know if there is an easy way to
> call functions generically with N numbers of arguments a bit like this :
>
> void call( boost::python::object bpFunction, ... )
> {
>      // Here i want to find a way to call the bpFunction with the variable
> argument list
> }
>   

Just a couple of days ago I have checked in support for this into the 
trunk (it's too late for the upcoming 36 release, but should be part of 
the next one). With that, you will be able to do

void call(boost::python::object callable)
{
  boost::python::list args;
  // ... now fill the list

  callable(*args);
}

HTH,
       Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...




More information about the Cplusplus-sig mailing list