Fix a strange warning in QtCreator:

/cvs/lyx/lyx-devel/src/frontends/qt/TocModel.cpp:356: warning: loop variable 'toc' has type 'const pair<std::string, shared_ptr<lyx::Toc> > &' (aka 'const pair<basic_string<char>, shared_ptr<vector<lyx::TocItem> > > &') but is initialized with type 'const std::pair<const std::__cxx11::basic_string<char>, std::shared_ptr<std::vector<lyx::TocItem, std::allocator<lyx::TocItem> > > >' resulting in a copy

/cvs/lyx/lyx-devel/src/frontends/qt/TocModel.cpp:356: use non-reference type 'pair<std::string, shared_ptr<lyx::Toc> >' (aka 'pair<basic_string<char>, shared_ptr<vector<lyx::TocItem> > >') to keep the copy or type 'const std::pair<const std::__cxx11::basic_string<char>, std::shared_ptr<std::vector<lyx::TocItem, std::allocator<lyx::TocItem> > > > &' to prevent copying

Easier just to use 'auto'.
This commit is contained in:
Richard Kimberly Heck 2020-02-14 11:11:12 -05:00
parent f12c4dbcd9
commit fb03f2a5ec

View File

@ -353,7 +353,7 @@ void TocModels::reset(BufferView const * bv)
names_->insertColumns(0, 1);
// In the outliner, add Tocs from the master document
TocBackend const & backend = bv->buffer().masterBuffer()->tocBackend();
for (pair<string, shared_ptr<Toc>> const & toc : backend.tocs()) {
for (auto const & toc : backend.tocs()) {
QString const type = toqstr(toc.first);
// First, fill in the toc models.