ArrayProperty: update at() to cast as well.

This commit is contained in:
Guillaume Jacquemin 2021-09-23 21:54:59 +02:00
parent 76e36791d7
commit 79e3193309

View file

@ -27,12 +27,14 @@ struct ArrayProperty : public UnrealPropertyBase {
propertyType = "ArrayProperty";
}
auto at(std::size_t index) -> UnrealPropertyBase* {
template<typename T>
std::enable_if_t<std::is_base_of<UnrealPropertyBase, T>::value, T*>
at(std::size_t index) {
if(index >= items.size()) {
return nullptr;
}
return items[index].get();
return static_cast<T*>(items[index].get());
}
std::string itemType;