[SOLVED]Unable to Use TQueue

Hi Everyone I am having trouble with using TQueue I have asked the question on answerhub asking again for more responses.

Background [HR][/HR]
So I have a class That is responsible for creating resources and adding them to a pool. This class can store any type of AActor and for each AActor I will be having a different queue as I need to continuously push and pop AActor based on usage in constant time complexity as the number of records can be large and the whole point of this class is to improve performance. This class will also destroy the actors when the game ends. The user would be setting the max pool size for each actor from blueprint.

Issue [HR][/HR]
The issue is I am unable to use TQueue like following


TMap<TSubclassOf<AActor>,TQueue<AActor*>> Pool;

I have tried encapsulating queue in a structure like this


USTRUCT()
struct FConversion
{
GENERATED_BODY()

public:
TQueue<AActor*>act;
};

but I get an error


FConversion &FConversion::operator =(const FConversion &)': function was implicitly deleted because a data member invokes a deleted or inaccessible function 'TQueue<AActor *,EQueueMode::Spsc> &TQueue<AActor *,EQueueMode::Spsc>::operator =(const TQueue<AActor *,EQueueMode::Spsc> &)'

I am trying to have a queue so that records inserted in FIFO manner only I could use MultiMap but I am not sure that for a key FIFO ordering is maintained. Could anyone help on this I am stuck on this for quite a long time.

Bump any help would be appreciated :frowning:

You need to disable the generated Copy/Assignment operator since the TQueue doesn’t allow it. You can use struct ops to do that.



template<>
struct TStructOpsTypeTraits< FConversion > : public TStructOpsTypeTraitsBase2< FConversion >
{
   enum
   {
      WithCopy = false
   };
};



Just toss that after your Struct definition. I don’t remember if there is a “WithAssignment” option (if so, you may need to add it and set it to false as well). This all just means the compiler won’t add an override for the = operator so you can’t do.



FConversion A;
FConversion B;
A = B; // Invalid, that operator was deleted.


Which means if you’re using this in a map, you may need to do something where you add options emplace and then manually copy them or what not.

Thank you :slight_smile: