Repository: microsoft/terminal
File: src/cascadia/TerminalSettingsEditor/SettingContainer.cpp (C++)

Code before:

                // apply name (automation property)
                Automation::AutomationProperties::SetName(child, RS_(L"SettingContainer_OverrideMessageBaseLayer"));
            }
        }

        _UpdateOverrideSystem();

        // Get the correct base to apply automation properties to
        std::vector<DependencyObject> base(2, nullptr);
        if (const auto& child{ GetTemplateChild(L"Expander") })
        {
            if (const auto& expander{ child.try_as<Microsoft::UI::Xaml::Controls::Expander>() })
            {
                base.push_back(child);
            }
        }
        if (const auto& content{ Content() })
        {
            if (const auto& obj{ content.try_as<DependencyObject>() })
            {
                base.push_back(obj);
            }
        }

        for (auto obj : base)
        {
            if (obj)
            {
                // apply header as name (automation property)
                if (const auto& header{ Header() })
                {
                    if (const auto headerText{ header.try_as<hstring>() })
                    {
                        Automation::AutomationProperties::SetName(obj, *headerText);
                    }
                }

                // apply help text as tooltip and full description (automation property)
                if (const auto& helpText{ HelpText() }; !helpText.empty())
                {
                    Controls::ToolTipService::SetToolTip(obj, box_value(helpText));
                    Automation::AutomationProperties::SetFullDescription(obj, helpText);
                }
                else
                {
                    Controls::ToolTipService::SetToolTip(obj, nullptr);
                    Automation::AutomationProperties::SetFullDescription(obj, L"");
                }
            }
        }

Review comment (suggestion):
```suggestion
        for (const auto& obj : base)
```

Code after:

                // apply name (automation property)
                Automation::AutomationProperties::SetName(child, RS_(L"SettingContainer_OverrideMessageBaseLayer"));
            }
        }

        _UpdateOverrideSystem();

        // Get the correct base to apply automation properties to
        std::vector<DependencyObject> base;
        base.reserve(2);
        if (const auto& child{ GetTemplateChild(L"Expander") })
        {
            if (const auto& expander{ child.try_as<Microsoft::UI::Xaml::Controls::Expander>() })
            {
                base.push_back(child);
            }
        }
        if (const auto& content{ Content() })
        {
            const auto& panel{ content.try_as<Controls::Panel>() };
            const auto& obj{ content.try_as<DependencyObject>() };
            if (!panel && obj)
            {
                base.push_back(obj);
            }
        }

        for (const auto& obj : base)
        {
            // apply header as name (automation property)
            if (const auto& header{ Header() })
            {
                if (const auto headerText{ header.try_as<hstring>() })
                {
                    Automation::AutomationProperties::SetName(obj, *headerText);
                }
            }

            // apply help text as tooltip and full description (automation property)
            if (const auto& helpText{ HelpText() }; !helpText.empty())
            {
                Automation::AutomationProperties::SetFullDescription(obj, helpText);
            }
            else
            {
                Controls::ToolTipService::SetToolTip(obj, nullptr);
                Automation::AutomationProperties::SetFullDescription(obj, L"");
            }
        }