remove bool from shared_ptr as well.
This commit is contained in:
parent
dd26e8a014
commit
a67eff0ae9
1 changed files with 6 additions and 6 deletions
|
|
@ -80,35 +80,35 @@ namespace swig {
|
||||||
|
|
||||||
template <class Type>
|
template <class Type>
|
||||||
struct traits_as<std::shared_ptr<Type>, pointer_category> {
|
struct traits_as<std::shared_ptr<Type>, pointer_category> {
|
||||||
static std::shared_ptr<Type> as(VALUE obj, bool throw_error) {
|
static std::shared_ptr<Type> as(VALUE obj) {
|
||||||
std::shared_ptr<Type> ret;
|
std::shared_ptr<Type> ret;
|
||||||
std::shared_ptr<Type> *v = &ret;
|
std::shared_ptr<Type> *v = &ret;
|
||||||
int res = traits_asptr<std::shared_ptr<Type> >::asptr(obj, &v);
|
int res = traits_asptr<std::shared_ptr<Type> >::asptr(obj, &v);
|
||||||
if (SWIG_IsOK(res)) {
|
if (SWIG_IsOK(res)) {
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
if (throw_error) throw std::invalid_argument("bad type");
|
|
||||||
VALUE lastErr = rb_gv_get("$!");
|
VALUE lastErr = rb_gv_get("$!");
|
||||||
if (lastErr == Qnil)
|
if (lastErr == Qnil)
|
||||||
SWIG_Error(SWIG_TypeError, swig::type_name<std::shared_ptr<Type> >());
|
SWIG_Error(SWIG_TypeError, swig::type_name<std::shared_ptr<Type> >());
|
||||||
return std::shared_ptr<Type>();
|
throw std::invalid_argument("bad type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Type>
|
template <class Type>
|
||||||
struct traits_as<std::shared_ptr<Type> *, pointer_category> {
|
struct traits_as<std::shared_ptr<Type> *, pointer_category> {
|
||||||
static std::shared_ptr<Type> * as(VALUE obj, bool throw_error) {
|
static std::shared_ptr<Type> * as(VALUE obj) {
|
||||||
std::shared_ptr<Type> *p = 0;
|
std::shared_ptr<Type> *p = 0;
|
||||||
int res = traits_asptr<std::shared_ptr<Type> >::asptr(obj, &p);
|
int res = traits_asptr<std::shared_ptr<Type> >::asptr(obj, &p);
|
||||||
if (SWIG_IsOK(res)) {
|
if (SWIG_IsOK(res)) {
|
||||||
return p;
|
return p;
|
||||||
} else {
|
} else {
|
||||||
if (throw_error) throw std::invalid_argument("bad type");
|
|
||||||
VALUE lastErr = rb_gv_get("$!");
|
VALUE lastErr = rb_gv_get("$!");
|
||||||
if (lastErr == Qnil)
|
if (lastErr == Qnil)
|
||||||
SWIG_Error(SWIG_TypeError, swig::type_name<std::shared_ptr<Type> *>());
|
SWIG_Error(SWIG_TypeError, swig::type_name<std::shared_ptr<Type> *>());
|
||||||
return 0;
|
throw std::invalid_argument("bad type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue