Download

Error on assign TMap Iterators on variables

Hello everyone,

I was trying to work with TMap and iterators but I think I’m missing something. Looks like I’m able to create an Iterator as long as it is scoped to a function, but if I try to have an iterator as a class variable, then it fires an error. The error itself doesn’t say much, or I am not able to understand it. (Implicit declaration, function is deleted)

I show an example of what I’m trying to do, on the first piece of code there is the variable declaration. On the second piece of code I try to initialize the variable.

On my .h



USTRUCT(BlueprintType)
struct FStatsModifier
{
     //Some variables and code
private:
    UPROPERTY(BlueprintReadOnly, EditAnywhere)
        TMap<ECHARACTER_STATS, uint8> Modifiers;

     TMap<ECHARACTER_STATS, uint8>::TConstIterator Iter;
};



And on my .cpp




void FStatsModifier::Iterator_Reset()
{

    Iter  = Modifiers.CreateConstIterator(); //Error the function is deleted
    TMap<ECHARACTER_STATS, uint8>::TConstIterator b = Modifiers.CreateConstIterator(); //Works fine
     Iter = b; //Error the function is deleted

}



I’m sure that’s because I miss something or I miss understood some concepts

Any help will be gratefull!

Thanks in advance