@@ -89,17 +89,47 @@ struct X {
8989 abcd.append (d);
9090 return " int(%s); char(%s); string(%s); double(%s); " % tuple (abcd);
9191 }
92+
93+ object
94+ foo (int a, bool b=false ) const
95+ {
96+ list ab;
97+ ab.append (a);
98+ ab.append (b);
99+ return " int(%s); bool(%s); " % tuple (ab);
100+ }
101+
102+ object
103+ foo (std::string a, bool b=false ) const
104+ {
105+ list ab;
106+ ab.append (a);
107+ ab.append (b);
108+ return " string(%s); bool(%s); " % tuple (ab);
109+ }
110+
111+ object
112+ foo (list a, list b, bool c=false ) const
113+ {
114+ list abc;
115+ abc.append (a);
116+ abc.append (b);
117+ abc.append (c);
118+ return " list(%s); list(%s); bool(%s); " % tuple (abc);
119+ }
92120};
93121
94122BOOST_PYTHON_MEM_FUN_GENERATOR (X_bar_stubs, bar, 1 , 4 )
123+ BOOST_PYTHON_MEM_FUN_GENERATOR(X_foo_2_stubs, foo, 1 , 2 )
124+ BOOST_PYTHON_MEM_FUN_GENERATOR(X_foo_3_stubs, foo, 2 , 3 )
95125
96126// /////////////////////////////////////////////////////////////////////////////
97127
98128BOOST_PYTHON_MODULE_INIT(defaults_ext)
99129{
100130 module (" defaults_ext" )
101131 .def (" foo" , foo, foo_stubs ())
102-
132+
103133#if !(defined(BOOST_MSVC) && (BOOST_MSVC <= 1200))
104134 .def (" bar" , signature<object (*)(int , char , std::string, double )>(), bar_stubs ())
105135#else // signature does not work on VC6 only (VC7 is ok)
@@ -109,7 +139,17 @@ BOOST_PYTHON_MODULE_INIT(defaults_ext)
109139
110140 class_<X>(" X" )
111141 .def (" bar" , &X::bar, X_bar_stubs ())
142+ .def (" foo" , (object (X::*)(std::string, bool ) const )0 , X_foo_2_stubs ())
143+
144+ #if !(defined(BOOST_MSVC) && (BOOST_MSVC <= 1200))
145+ .def (" foo" , signature<object (X::*)(int , bool ) const >(), X_foo_2_stubs ())
146+ #else // signature does not work on VC6 only (VC7 is ok)
147+ .def (" foo" , (object (X::*)(int , bool ) const )0 , X_foo_2_stubs ())
148+ #endif
149+
150+ .def (" foo" , (object (X::*)(list, list, bool ) const )0 , X_foo_3_stubs ())
112151 ;
113152}
114153
115154#include " module_tail.cpp"
155+
0 commit comments