Repository: dotnet/runtime
File: src/native/corehost/hostpolicy/deps_resolver.cpp (C++)

Code before:
    }

    // A uniqifying append helper that doesn't let two entries with the same
    // "asset_name" be part of the "items" paths.
    void add_tpa_asset(
        const pal::string_t& name,
        const deps_asset_t* asset,
        pal::string_t&& resolved_path,
        name_to_resolved_asset_map_t* items)
    {
        name_to_resolved_asset_map_t::iterator existing = items->find(name);
        if (existing == items->end())
        {
            deps_resolved_asset_t resolved_asset(asset, std::move(resolved_path));

            if (trace::is_enabled())
            {
                trace::verbose(_X("Adding tpa entry: %s, AssemblyVersion: %s, FileVersion: %s"),
                    resolved_asset.resolved_path.c_str(),
                    resolved_asset.assembly_version().as_str().c_str(),
                    resolved_asset.file_version().as_str().c_str());
            }

            items->emplace(name, std::move(resolved_asset));
        }
    }

    // -----------------------------------------------------------------------------
    // Load local assemblies by priority order of their file extensions and
    // uniquified by their simple name.
    //
    void get_dir_assemblies(
        const pal::string_t& dir,
        const pal::string_t& dir_name,
        name_to_resolved_asset_map_t* items)
    {
        trace::verbose(_X("Adding files from %s dir %s"), dir_name.c_str(), dir.c_str());

        // Managed extensions in priority order, pick DLL over EXE.
        const pal::string_t managed_ext[] = { _X(".dll"), _X(".exe") };

        // List of files in the dir
        std::vector<pal::string_t> files;
        pal::readdir(dir, &files);

        for (const auto& ext : managed_ext)
        {
            for (const auto& file : files)
            {
                // Nothing to do if file length is smaller than expected ext.
                if (file.length() <= ext.length())

Review comment (refactor):
This file uses `std::move` (e.g., when constructing/emplacing `deps_resolved_asset_t`) but doesn't explicitly include `<utility>`. Add the include to avoid depending on transitive includes.

Code after:
        return path.substr(name_pos + 1);
    }

    // A uniqifying append helper that doesn't let two entries with the same
    // "asset_name" be part of the "items" paths.
    void add_tpa_asset(
        const pal::string_t& name,
        const deps_asset_t* asset,
        pal::string_t&& resolved_path,
        name_to_resolved_asset_map_t* items)
    {
        name_to_resolved_asset_map_t::iterator existing = items->find(name);
        if (existing == items->end())
        {
            deps_resolved_asset_t resolved_asset(asset, std::move(resolved_path));

            if (trace::is_enabled())
            {
                trace::verbose(_X("Adding tpa entry: %s, AssemblyVersion: %s, FileVersion: %s"),
                    resolved_asset.resolved_path.c_str(),
                    resolved_asset.assembly_version().as_str().c_str(),
                    resolved_asset.file_version().as_str().c_str());
            }

            items->emplace(name, std::move(resolved_asset));
        }
    }

    // -----------------------------------------------------------------------------
    // Load local assemblies by priority order of their file extensions and
    // uniquified by their simple name.
    //
    void get_dir_assemblies(
        const pal::string_t& dir,
        const pal::string_t& dir_name,
        name_to_resolved_asset_map_t* items)
    {
        trace::verbose(_X("Adding files from %s dir %s"), dir_name.c_str(), dir.c_str());

        // Managed extensions in priority order, pick DLL over EXE.
        const pal::string_t managed_ext[] = { _X(".dll"), _X(".exe") };

        // List of files in the dir
        std::vector<pal::string_t> files;
        pal::readdir(dir, &files);

        for (const auto& ext : managed_ext)
        {
            for (const auto& file : files)
            {
                // Nothing to do if file length is smaller than expected ext.