warning fix in yaml header
MR fixes the following warning:
In file included from /u/sgorbuno/cbm/cbmroot/external/yaml-cpp/include/yaml-cpp/yaml.h:17,
from /u/sgorbuno/cbm/cbmroot/core/utility/yaml/CbmYaml.h:18,
from /u/sgorbuno/cbm/cbmroot/core/run/CbmRunDatabase.h:19,
from /u/sgorbuno/cbm/cbmroot/core/run/CbmRunDatabase.cxx:10:
In member function ‘T YAML::Node::as() const [with T = std::__cxx11::basic_string<char>]’,
inlined from ‘T cbm::util::yaml::Read(const YAML::Node&) [with T = std::__cxx11::basic_string<char>]’ at
/u/sgorbuno/cbm/cbmroot/core/utility/yaml/CbmYaml.h:91:28,
inlined from ‘T cbm::util::yaml::Read(const YAML::Node&) [with T = std::map<unsigned int, std::__cxx11::basic_string<char> >]’ at
/u/sgorbuno/cbm/cbmroot/core/utility/yaml/CbmYaml.h:133:31:
/u/sgorbuno/cbm/cbmroot/external/yaml-cpp/include/yaml-cpp/node/impl.h:154:8: warning: using a dangling pointer to an unnamed temporary [-
Wdangling-pointer=]
154 | if (!m_isValid)
| ^~~~~~~~~
/u/sgorbuno/cbm/cbmroot/core/utility/yaml/CbmYaml.h: In function ‘T cbm::util::yaml::Read(const YAML::Node&) [with T = std::map<unsigned int,
std::__cxx11::basic_string<char> >]’:
/u/sgorbuno/cbm/cbmroot/core/utility/yaml/CbmYaml.h:132:37: note: unnamed temporary defined here
132 | const auto& value = it->second;
| ~~~~^~~~~~
In member function ‘T YAML::Node::as() const [with T = unsigned int]’,
inlined from ‘T cbm::util::yaml::Read(const YAML::Node&) [with T = unsigned int]’ at
/u/sgorbuno/cbm/cbmroot/core/utility/yaml/CbmYaml.h:91:27,
inlined from ‘T cbm::util::yaml::Read(const YAML::Node&) [with T = std::map<unsigned int, std::__cxx11::basic_string<char> >]’ at /u/sgorbuno/cbm/cbmroot/core/utility/yaml/CbmYaml.h:133:24:
/u/sgorbuno/cbm/cbmroot/external/yaml-cpp/include/yaml-cpp/node/impl.h:154:8: warning: dangling pointer to an unnamed temporary may be used [-
Wdangling-pointer=]
154 | if (!m_isValid)
| ^~~~~~~~~
/u/sgorbuno/cbm/cbmroot/core/utility/yaml/CbmYaml.h: In function ‘T cbm::util::yaml::Read(const YAML::Node&) [with T = std::map<unsigned int,
std::__cxx11::basic_string<char> >]’:
/u/sgorbuno/cbm/cbmroot/core/utility/yaml/CbmYaml.h:131:37: note: unnamed temporary defined here
131 | const auto& key = it->first;
| ~~~~^~~~~
Edited by Sergey Gorbunov