TArray数组

    TArray<int32> arr;
    arr.Init(0,5);
    for (int index = 0; index < arr.Num(); index++)
    {
        FString str = FString("");
        str.AppendInt(arr[index]);
        UE_LOG(LogTemp, Log, TEXT("%s"),*str);
    }

    TArray<TArray<int32>> twoArr;
    twoArr.Init(TArray<int32>(),3);
    for (int index = 0; index < twoArr.Num(); index++)
    {
        twoArr[index].Init(0,3);
    }
    int count = 0;
    for(int i=0;i<twoArr.Num();i++)
        for (int j = 0; j < twoArr[i].Num(); j++)
        {
            twoArr[i][j] = count++;
        }

    for (int i = 0; i < twoArr.Num(); i++)
        for (int j = 0; j < twoArr[i].Num(); j++)
        {
            FString str = FString("");
            str.AppendInt(twoArr[i][j]);
            UE_LOG(LogTemp, Log, TEXT("%s"), *str);
        }

 

posted @ 2019-02-19 19:08  露夕逝  阅读(894)  评论(0编辑  收藏  举报