we got the same problem as mentioned in
this thread.
but we fix it according to IsCopyable traits
here is our modifications...
template<typename T, bool Copyable = IsCopyable<T>::value >
struct CreateCopyInstanceHelper
{
inline static BOOL Create(HSQUIRRELVM v, const SQChar * className,const T & classToCopy)
{
if (!CreateConstructNativeClassInstance(v,className)) {
return FALSE;
} // if
SQUserPointer up=0;
sq_getinstanceup(v,-1,&up,ClassType<T>::type());
if (!up) return FALSE;
T * newClass = (T *)up;
*newClass = classToCopy; // <TODO> Optimized version that uses the copy constructor.
return TRUE;
}
};
template<typename T>
struct CreateCopyInstanceHelper<T, false>
{
inline static BOOL Create(HSQUIRRELVM v, const SQChar * className,const T & classToCopy)
{
return FALSE;
}
};
template<typename T>
inline BOOL CreateCopyInstance(HSQUIRRELVM v, const SQChar * className,const T & classToCopy) {
#ifndef SQPLUS_DISABLE_COPY_INSTANCES
return CreateCopyInstanceHelper<T>::Create(v, className, classToCopy);
#else
return FALSE;
#endif
} // CreateCopyInstance
Regards,
KZ