An error occurred while loading the file. Please try again.
-
ilor authored
add .get(), __bool__ and __nonzero__ to shared_ptr wrapper to allow testing if the shared_ptr is valid
f6c21cd8
boost_shared_ptr.i 475 B
/**
* Wrapper for boost shared_ptr
*/
#ifndef SWIG_BOOST_SHAREDPTR
#define SWIG_BOOST_SHAREDPTR
%module boost_shared_ptr
%{
%}
namespace boost {
template<class T> class shared_ptr {
public:
shared_ptr();
shared_ptr(T * p);
T* operator->();
T* get();
%pythoncode %{
def __bool__(self):
return self.get() is not None
__nonzero__=__bool__
%}
private:
T * px;
int pn;
};
}
using namespace boost;
#endif /* SWIG_BOOST_SHAREDPTR */