[LyX/master] C++11 compilation fix

Jean-Marc Lasgouttes lasgouttes at lyx.org
Wed Dec 7 16:04:58 UTC 2022


Le 06/12/2022 à 16:17, Jean-Marc Lasgouttes a écrit :
> commit f3f478c2fbcf89302ccadeb30aac413a40039d12
> Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
> Date:   Tue Dec 6 17:12:45 2022 +0100
> 
>      C++11 compilation fix

>   	for (iter = refs_.begin(); iter != refs_.end(); ++iter) {
>   		// first: plain label name, second: gui name
>   		QString const lab = toqstr((*iter).first);
> -		refsNames.append(QPair(lab, toqstr((*iter).second)));
> +		refsNames.append({lab, toqstr((*iter).second)});

This elicited the answer "Huh?" from Jürgen, but sent to the lyx-cvs 
list, so only Riki and I saw it.

Could I have a authoritative answer to the question whether a 
constructor like QPair(a, b) can be replaced with {a, b} when the 
context is clear enough?

I notice that we use that already, but I may be wrong about when it is 
acceptable.

JMarc

$ git grep '({' src
src/Buffer.cpp: 
children_positions.insert({child, it});
src/BufferView.cpp:                                     success = 
setCursorFromEntries({id, pos},
src/Encoding.cpp:       : text_commands_({text_command}), 
math_commands_({math_command}),
src/Session.cpp:                        bip.push_back({i, 
bookmarks[i].top_pos});
src/TocBackend.cpp:     return tocs_.insert({type, 
make_shared<Toc>()}).first->second;
src/TocBackend.cpp:     outliner_names_.insert({type, name});
src/frontends/qt/GuiApplication.cpp: 
aliases.push_back({toqstr(from), toqstr(to)});
src/frontends/qt/GuiRef.cpp:            refsNames.append({lab, 
toqstr((*iter).second)});
src/frontends/qt/GuiSymbols.cpp: 
used_blocks.insert({getBlock(c), numItem});
src/frontends/qt/GuiView.cpp:           QStringList const filter({
src/frontends/qt/GuiWorkArea.cpp: 
setMessageColour({notificationFrame}, {reloadPB, ignorePB});
src/insets/InsetText.cpp: 
addtotoc_stack.push({pit, end});
src/output_latex.cpp:           ilist.insert({nr, arg});
src/tex2lyx/Preamble.cpp:       used_packages.insert({name, 
split_options(h_options)});



More information about the lyx-devel mailing list