Boost logo

Boost :

From: scott snyder (snyder_at_[hidden])
Date: 2001-12-02 19:55:29


hi -

Here's a little patch to the boost::python class_builder (against boost 1.25.1)
to make it easier to define nested classes, by allowing one to
specify another class_builder (or the extension_class pointer
directly) in the class_builder constructor instead of a module_builder.

sss

--- boost/python/class_builder.hpp-orig2 Sat Dec 1 12:15:55 2001
+++ boost/python/class_builder.hpp Sat Dec 1 12:47:01 2001
@@ -25,6 +25,21 @@
         module.add(ref(as_object(m_class.get()), ref::increment_count), name);
     }
     
+ template <class Other>
+ class_builder(class_builder<Other>& cls, const char* name)
+ : m_class(new detail::extension_class<T, U>(name))
+ {
+ cls.add(ref(as_object(m_class.get()), ref::increment_count), name);
+ }
+
+ template <class Other>
+ class_builder(detail::extension_class<Other>* cls, const char* name)
+ : m_class(new detail::extension_class<T, U>(name))
+ {
+ cls->set_attribute(name,
+ ref(as_object(m_class.get()), ref::increment_count));
+ }
+
     ~class_builder()
     {}
 


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