简体   繁体   中英

how to use parameters of class_ from boost.python

The first question: The class_ class has four parameters.

class template class_<T, Bases, HeldType, NonCopyable>

I don't understand the parameters of Bases and HeldType.How to use the parameters. this doc: http://www.boost.org/doc/libs/1_51_0/libs/python/doc/v2/class.html

The second question: I have to make a python function as callback of a c++ function.How to do?Where can I find some examples??

The HeldType is usefull, if you want to use a special object to hold your object. For eg if you use shared_ptr<> inside your implementation you can use this as HeldType.

If you have no idea what shared_ptr are, just google for them, they are a nice tool.

Further descriptions as an example for the shared_ptr<> as HeldType can be found here: Python Wiki, deailing with smart pointers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM