[C++-sig] Passing default argument

Goudar Basavaraj (IFIN DC SMS) Basavaraj.Goudar at infineon.com
Mon Nov 3 12:41:05 CET 2003


Hi,

	I am facing a problem in passing default parameters to this program.

class A
{
	public:
	A(){}
	void f(int a=2,int b=4,int c=10,int d=4)
	{
	 	printf("HI am here\n");
	}
};
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(F1,A::f,0,4)

BOOST_PYTHON_MODULE(overload)
{
    class_<A>("A")
    	.def("F",&A::f,F1(args("a","b","c","d")))
    ;
}

	I call the overloaded method from python by passing
	>>>name=overload.A()
	>>>name.F(a=0)  //This works fine
	>>>name.F(a=0,b=1)   //This works fine
	>>>name.F(b=1)     //Fails.
		 bad argument type for built in operation


	I am not able to figure out whether this is the property of boost or
I have to do something else.

	Please let me know................

Thanks & Regards,
Basavaraj




More information about the Cplusplus-sig mailing list