mercredi 6 juillet 2016

C++ functions (surcharge & const)

I have the following code

//*********************************************
Section&
BasicConfig::section (std::string const& name)
{
    return map_[name];
}
//*************************************************
Section const&
BasicConfig::section (std::string const& name) const
{
    static Section none("");
    auto const iter = map_.find (name);
    if (iter == map_.end())
        return none;
    return iter->second;
}

if I write : section("database_path");

Which script will be executed ?

Aucun commentaire:

Enregistrer un commentaire