diff --git a/include/boost/python/class.hpp b/include/boost/python/class.hpp index 0928c398..2753267d 100644 --- a/include/boost/python/class.hpp +++ b/include/boost/python/class.hpp @@ -301,15 +301,40 @@ class class_ : public objects::class_base } // Property creation + private: template - self& add_property(char const* name, Get fget, char const* docstr = 0) + self& add_property_impl(char const* name, Get fget, char const* docstr, int) { base::add_property(name, this->make_getter(fget), docstr); return *this; } template - self& add_property(char const* name, Get fget, Set fset, char const* docstr = 0) + self& add_property_impl(char const* name, Get fget, Set fset, ...) + { + base::add_property( + name, this->make_getter(fget), this->make_setter(fset), 0); + return *this; + } + + public: + template + self& add_property(char const* name, Get fget) + { + base::add_property(name, this->make_getter(fget), 0); + return *this; + } + + template + self& add_property(char const* name, Get fget, DocStrOrSet docstr_or_set) + { + this->add_property_impl(name, this->make_getter(fget), docstr_or_set, 0); + return *this; + } + + template + self& + add_property(char const* name, Get fget, Set fset, char const* docstr) { base::add_property( name, this->make_getter(fget), this->make_setter(fset), docstr);