Equivalent of custodian_and_ward?
I'm wrapping some boost::random stuff. Previously, I used boost::python, and needed custodian_and_ward.
example:
class_
("uniform_int", "Uniform integer distribution", python:
python::arg ("rng"),
python::arg ("min"),
python::arg ("max")
),
"Construct a uniform int variate generator U[min...max)\n\n"
" `r` : rng\n"
" Mersenne Twister\n"
" `min` : int\n"
" min\n"
" `max` : int\n"
" max\n"
)
[python:
...
struct boost_uniform_
boost:
boost_
gen (r, boost::
int Generate1 () { return gen(); }
ublas:
ublas:
for (ublas:
*i = Generate1();
return out;
}
};
The "uniform_int" object holds a reference to the rng_t object, so the rng_t object must not be deleted while uniform_int is alive.
How to do this with pybindgen?
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- PyBindGen Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask nbecker for more information if necessary.