mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 16:51:21 -06:00
Replace to_SV_ref() and to_SV_clone_ref() with templated glue functions
This commit is contained in:
parent
f76e2c2222
commit
76a8ec3d9e
54 changed files with 39 additions and 254 deletions
|
|
@ -23,7 +23,21 @@ template<class T>
|
|||
const char* perl_class_name(const T*) { return ClassTraits<T>::name; }
|
||||
template<class T>
|
||||
const char* perl_class_name_ref(const T*) { return ClassTraits<T>::name_ref; }
|
||||
|
||||
|
||||
template<class T>
|
||||
SV* perl_to_SV_ref(T &t) {
|
||||
SV* sv = newSV(0);
|
||||
sv_setref_pv( sv, perl_class_name_ref(&t), &t );
|
||||
return sv;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
SV* perl_to_SV_clone_ref(const T &t) {
|
||||
SV* sv = newSV(0);
|
||||
sv_setref_pv( sv, perl_class_name(&t), new T(t) );
|
||||
return sv;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class Ref {
|
||||
T* val;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue