如何格式化c ++数组初始化列表

时间:2018-01-26 14:18:33

标签: c++ arrays formatting visual-studio-2017 initializer-list

我无法让Visual Studio正确格式化初始化列表。 This目前的样子,IMO非常难看。

我喜欢这样做,看起来像very clean in c#。 我知道我在c ++中做的与c#有点不同。 :)

我使用的是虚幻引擎,因此TArray类型(" Affixes"也是TArray)。

C ++:

    Affixes.Append(TArray<FAffixGenerator>{
        FAffixGenerator(
            EStatsType::Local_IncreasedPhysicalDamage,
            EAffixType::Prefix,
            TArray<EEquipableType>
        {
            EEquipableType::Axe,
                EEquipableType::Sword
        },
            TArray<FAffixValues2D>
            {
                FAffixValues2D("Hefty", 0, FVector2D(10, 15)),
                    FAffixValues2D("Bulky", 5, FVector2D(16, 30)),
                    FAffixValues2D("Heavy", 10, FVector2D(31, 45)),
                    FAffixValues2D("Great", 15, FVector2D(46, 65)),
                    FAffixValues2D("Mighty", 20, FVector2D(66, 90)),
                    FAffixValues2D("Massive", 25, FVector2D(91, 120))
            })
    });

C#:

        Affixes.Add(new AffixGenerator()
        {
            StatType = EStatType.Local_IncreasedPhysicalDamage,
            AffixType = EAffixType.Prefix,
            ItemTypes = new List<EEquipableType>
            {
                EEquipableType.Axe,
                EEquipableType.Sword
            },
            GenerationValues = new List<AffixValues2D>
            {
                new AffixValues2D("Hefty", 0, new MinMaxValue(10, 15)),
                new AffixValues2D("Bulky", 5, new MinMaxValue(16, 30)),
                new AffixValues2D("Heavy", 10, new MinMaxValue(31, 45)),
                new AffixValues2D("Great", 15, new MinMaxValue(46, 65)),
                new AffixValues2D("Mighty",20, new MinMaxValue(66, 90)),
                new AffixValues2D("Massive", 25, new MinMaxValue(91, 120))
            }
        });

0 个答案:

没有答案