It would appear that TQueue has a private copy constructor to prevent copying for some reason.
How Can I create TQueue using NewObject?
The short answer is that you don’t, TQueue does not derive from UObject so you can’t create instances using NewObject.
You could manage those allocations directly using
delete, but that’s not really recommended. Ideally you’d probably want to use TUniquePtr, but that seems to have similar issues to TQueue.
TSharedPtr seems to work so instead of:
TMap<TSubclassOf<AActor>, TQueue<AActor*>*> FinalPool;
TMap<TSubclassOf<AActor>, TSharedPtr<TQueue<AActor*>>> FinalPool;
and you’d make your queue with a call to
All that being said, I wouldn’t recommend this approach. There are a number of gotchas with using maps like this that leave a number of potential landmines.
I would recommend using a simpler container like TArray instead of TQueue. I have a number of maps with TArrays as values and it works great. It’s also not hard to treat an array as a queue even if it might not have the same performance profile in some cases. Which I doubt you need to worry about at this time.