Return objects by reference instead of always cloning

This commit is contained in:
Alessandro Ranellucci 2013-09-02 20:22:20 +02:00
parent 1741301973
commit c0789506e4
30 changed files with 158 additions and 54 deletions

View file

@ -73,7 +73,21 @@ Point::distance_to(const Point* point) const
}
SV*
Point::to_SV_pureperl() {
Point::to_SV_ref() const {
SV* sv = newSV(0);
sv_setref_pv( sv, "Slic3r::Point::Ref", (void*)this );
return sv;
}
SV*
Point::to_SV_clone_ref() const {
SV* sv = newSV(0);
sv_setref_pv( sv, "Slic3r::Point", new Point(*this) );
return sv;
}
SV*
Point::to_SV_pureperl() const {
AV* av = newAV();
av_fill(av, 1);
av_store(av, 0, newSViv(this->x));