L
LaurieSt
Guest
Hi there,
Got this code (not mine) for fn definition
template<typename T>UInt64 GetTypeID<T *>(VMClassRegistry * registry)
{
UInt64 result;
typedef std::remove_pointer <IsArrayType<T>::TypedArg>::type BaseType;
if(!IsArrayType<T>::value) {
result = GetTypeIDFromFormTypeID(BaseType::kTypeID, registry);
} else { // Arrays are ClassInfo ptr + 1
result = GetTypeIDFromFormTypeID(BaseType::kTypeID, registry) | VMValue::kType_Identifier;
}
return result;
}
Instantiate fn in the same (header) module with this (not sure if this is best practice)
void PackArray(VMValue::ArrayData * data, VMClassRegistry * registry)
{
// Copy the contents from the reference array to the VM array
UInt32 i = 0;
for(typename std::vector<T>::iterator it = tList::Iterator::Begin(); it != tList::Iterator::End(); ++it, i++)
{
VMValue * value = data->GetData() + i;
PackValue(value, (T*)&(*it), registry);
value->type = GetTypeID<T>(registry);
// Always pack the type, even if empty data
}
}
};
Error (identifier not found) is on this line, where registry is a local variable:
value->type = GetTypeID<T>(registry); // Always pack the type, even if empty data
Unable to locate much info directly regarding this: we call it as <T> but it's actually <T *>?? Perhaps the compiler is confused as much as I. Tried inserting a few keywords- different errors. Any hints for the error begone welcome,
Thanks for reading.
A natural, B flat, C sharp, D compile
Continue reading...
Got this code (not mine) for fn definition
template<typename T>UInt64 GetTypeID<T *>(VMClassRegistry * registry)
{
UInt64 result;
typedef std::remove_pointer <IsArrayType<T>::TypedArg>::type BaseType;
if(!IsArrayType<T>::value) {
result = GetTypeIDFromFormTypeID(BaseType::kTypeID, registry);
} else { // Arrays are ClassInfo ptr + 1
result = GetTypeIDFromFormTypeID(BaseType::kTypeID, registry) | VMValue::kType_Identifier;
}
return result;
}
Instantiate fn in the same (header) module with this (not sure if this is best practice)
void PackArray(VMValue::ArrayData * data, VMClassRegistry * registry)
{
// Copy the contents from the reference array to the VM array
UInt32 i = 0;
for(typename std::vector<T>::iterator it = tList::Iterator::Begin(); it != tList::Iterator::End(); ++it, i++)
{
VMValue * value = data->GetData() + i;
PackValue(value, (T*)&(*it), registry);
value->type = GetTypeID<T>(registry);
// Always pack the type, even if empty data
}
}
};
Error (identifier not found) is on this line, where registry is a local variable:
value->type = GetTypeID<T>(registry); // Always pack the type, even if empty data
Unable to locate much info directly regarding this: we call it as <T> but it's actually <T *>?? Perhaps the compiler is confused as much as I. Tried inserting a few keywords- different errors. Any hints for the error begone welcome,
Thanks for reading.
A natural, B flat, C sharp, D compile
Continue reading...