dawnarc
(dawnarc)
1
I add a template function in my class, there is error LNK2019 when compile. dose UE4 support custom template function?
template<class T>
T* AssetsLoader::GetUObject(int32 AssetIndex)
{
if (AssetIndex < 0 || AssetIndex >= AssetsArray.Num())
{
return NULL;
}
return (T*)(AssetsArray[AssetIndex]);
}
Rama
(Rama)
2
Your template functions need to be posted in your .h file only, if you want them to work easily
I have a wiki on template functions here:
Here’s a template function that I submitted to the engine which Epic accepted in 4.3:
Rama
2 Likes
dawnarc
(dawnarc)
3
you are right! thx for your supply. by the way, your website is cool!