9#include <boost/python/extract.hpp>
10#include <boost/shared_ptr.hpp>
11#include <boost/weak_ptr.hpp>
18 inline bool check() const noexcept {
return m_value.get() !=
nullptr; }
41 using boost::python::extract;
42 if (extract<std::weak_ptr<T> &> extractWeakRef(pyvalue); extractWeakRef.check()) {
43 m_value = extractWeakRef().lock();
44 }
else if (extract<std::shared_ptr<T> &> extractSharedRef(pyvalue); extractSharedRef.check()) {
56 throw std::invalid_argument(
"Unable to extract shared_ptr from Python object");
const std::string & m_value