Revision 9722d4116de85406ac3729e587b0b4fa0d14fffa authored by Dmitri Naumov on 10 March 2021, 15:28:31 UTC, committed by Dmitri Naumov on 17 March 2021, 07:58:31 UTC
BaseLib::Counter is used in single place only, so
we can simplify that one place using MeshLib::Mesh
local static counter.
1 parent a7294bd
Raw File
Utils.cpp
/**
 * \file
 * \copyright
 * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#include "Utils.h"

namespace ParameterLib
{
ParameterBase* findParameterByName(
    std::string const& parameter_name,
    std::vector<std::unique_ptr<ParameterBase>> const& parameters)
{
    // Find corresponding parameter by name.
    auto const it = std::find_if(
        parameters.cbegin(), parameters.cend(),
        [&parameter_name](std::unique_ptr<ParameterBase> const& p) {
            return p->name == parameter_name;
        });

    if (it == parameters.end())
    {
        return nullptr;
    }

    DBUG("Found parameter `{:s}'.", (*it)->name);
    return it->get();
}
}  // namespace ParameterLib
back to top