| 2 | #include <string> |
| 3 | |
| 4 | class Example { |
| 5 | Example(std::string n) : mName(n) {} |
| 6 | std::string mName; |
| 7 | public: |
| 8 | std::string name() const { return mName; } |
| 9 | static Example* factory() |
| 10 | { |
| 11 | return new Example("factory"); |
| 12 | } |
| 13 | static Example* singleton() |
| 14 | { |
| 15 | static Example instance = Example("singleton"); |
| 16 | return &instance; |
| 17 | } |
| 18 | }; |
| 19 | |
| 20 | #include <boost/python.hpp> |
| 21 | using namespace boost::python; |