I ask to implement an intD auto-range integer variable on change and a dynamic array with a changing range in memory from the current intD variable range

TIntD Array;
IntD Size=Array.Num();
Array.SetArrayElem(18 446 744 073 709 551 615, “Last index”);

The variable intD must support any integer types and change its range when changed Data Type Ranges | Microsoft Docs

IntD::D(IntD Value){
If(Value<-2 147 483 648 && D!=int64){D=int64; MemoryResize();}
If(Value<-32 768 && D!=int32){D=int32; MemoryResize();}
If(Value<-128 && D!=int16){D=int16; MemoryResize();}
If(Value<128 && D!=int8){D=int8; MemoryResize();}
If(Value<256 && D!=uint8){D=uint8; MemoryResize();}
If(Value<65 536 && D!=uint16){D=uint16; MemoryResize();}
If(Value<4 294 967 296 && D!=uint32){D=uint32; MemoryResize();}
If(Value<=18 446 744 073 709 551 615 && D!=uint64){D=uint64; MemoryResize();}
}

IntD::Set(IntD Value){
Value.D(Value);
Value=Value;
}

template
static void TIntD::Id(TIntD Array, IntD Index){
if(Array.Num()>Index){Array.Resize(Index)}
}

template
static void TIntD::SetArrayElem(TIntD Array, IntD Index, B Value){
Array.Id(Index);
Array[Index]=V;
}

That would be tricky to implement since you need to preallocate specific size in memory for CPU to do anything and CPU can’t do that on it’s own. I think best approach would TArray of 8-bit values and make math code for that you could even try use GetData() to reinterpret native int types (thru you my have endianness issues on that)

You myght also want to check out TBigInt implementation since it seems so be something similar to what you want to implement but it’s static

Depending on the number, by condition, the IntD variable is copied to a new place in memory and the old place is deleted or truncated if the number requires less space (just like a dynamic array in C ++)
I see no reason to make arrays at once int64 Arrays of the new type of the IntD variable will be able to change their size in memory from the content. Also, I will finally be able to read databases that are missing for array because of int32. In general, it is inconvenient to make MMO games now because they need to be done through C ++, because there is no dynamic int in the current blueprints. But there is a dynamic float.

There no dynamic floats either, float type is 32-bit single precision float. C++ don’t support any dynamic types they need to be programmed, Yes you can copy in memory but you will contain pointer to know where it is and that is 64-bit integer memory address, as result whole thing will be taking even more memory space then it normally would, it would work same as array of 64-bit pointers to integers with there own space, you also need to track size data (8-bit each?).

That why array of 8 bit is more efficient, you would have single memory address but you can read fragments of array as 8-bit 16-bit and so on, but reading that would be tricky too. But now i if think about it it would be static and probably better to just use structs

It’s not C and C++ limitation it is CPU limitation, CPU don’t understand concept of variables only memory addresses and CPU need to know how much memory ahead to read from address… CPU don’t know what address to use for variable (again it doesn to know what variable is) and size, ad if it not hardcocded it needs to keep that information somewhere (64-bit pointer). Does not matter what programing language you use that limitation exists and run time of those languages do variues tricks to make you think something is dynamic, which is not magic and takes extra memory space to track that.

Maybe what you seek is database system?

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4038.html

From the point of view of the mmo game, the parameter variable first uint8 but when the range is exceeded, it increases to uint64 (include large numbers in the settings, since these are additional checks of ranges when changing) And these are variables for keeping the database in memory with minimal memory consumption (array range or the value of intD will be the pack’s uint8 fits into the range, otherwise it is stretched or re-created) The variable intD is not a replacement for Integer from blueprints, since one is for working with dynamic arrays (values ​​are out of range) and the other is for working with static arrays (values ​​will never go beyond range).

I think that when the number is reduced (excluding negative numbers), there is no need for overrun checks. Run at the player’s request optimization for dynamic intDs and intD arrays in the settings for the specified time period (like UE4 autosave)

Попытка использовать конструктора, который присваивает значения и тип числа неудачна=(
Attempting to use a constructor that assigns values ​​and the type of a number fails=(

//Тип динамического целого числа
UENUM(BlueprintType) enum class EUIntD:uint8{I8U,I16UU,I32U,I64U};
//Динамическое целое число
USTRUCT(BlueprintType)structIVS_APIFUIntD{ GENERATED_USTRUCT_BODY()
UPROPERTY(BlueprintReadOnly) FString UIntD;
UPROPERTY(BlueprintReadOnly) EUIntDD=EUIntD::I8U;
uint8S=8;
FUIntD():UIntD(TEXT(“0”)){}
FUIntD(uint64 I):UIntD(UVLbr::I64SToStr(I)){
if(I<256&&D!=EUIntD::I8U){D=EUIntD::I8U; return;}
if(I<65536&&D!=EUIntD::I16U){D=EUIntD::I16U; return;}
if(I<4294967296&&D!=EUIntD::I32U){D=EUIntD::I32U; return;}
//I<=18446744073709551615
if(D!=EUIntD::I64U){D=EUIntD::I64U;}
}
bool operator==(constFUIntD&I)const{return UIntD==I.UIntD && D==I.D;}
bool operator!=(constFUIntD&I)const{return !(*this==I);}
void UIntDSet(FStringI){FUIntD(C);}
auto UIntDGet(){returnFCString::Strtoui64(*UIntD,NULL,20);}
uint8DGet(){
if(D==EUIntD::I8U){D=EUIntD::I8U; return8;}
if(D==EUIntD::I16U){D=EUIntD::I16U; return16;}
if(D==EUIntD::I32U){D=EUIntD::I32U; return32;}
return64;
}
};
//Динамический массив
USTRUCT(BlueprintType)structIVS_APIFStrsD{ GENERATED_USTRUCT_BODY()
FUIntD UIntD;
TArray A;
TArray> F;
FStrsD():UIntD(TEXT(“0”)){}
FStrsD(uint64I):UIntD(UVLbr::I64SToStr(I)){
if(I<256&&D!=EUIntD::I8U){D=EUIntD::I8U; return;}
if(I<65536&&D!=EUIntD::I16U){D=EUIntD::I16U; return;}
if(I<4294967296&&D!=EUIntD::I32U){D=EUIntD::I32U; return;}
//I<=18446744073709551615
if(D!=EUIntD::I64U){D=EUIntD::I64U;}
}
bool operator==(constFStrsD&I)const{returnUIntD==I.UIntD&&A==I.A;}
bool operator!=(constFStrsD&I)const{return!(*this==I);}
voidStrsDSetArrayElement(FUIntDI,FStringV){A[I.UIntDGet()]=V;}
};