mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-02 18:12:43 +00:00
Replace to_SV_ref() and to_SV_clone_ref() with templated glue functions
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user