Skip to content

Avoid copy in structured binding

Marco Clemencic requested to merge clemenci-master-patch-49164 into master

When warnings from upstream headers are not ignored in the build, I'm getting this warning:

LHCb/Event/LinkerEvent/include/Linker/LinkerTable.h:99:24: warning: loop variable '<structured bindings>' creates a copy from type 'const std::pair<int, int>' [-Wrange-loop-construct]
   99 |       for ( auto const [source, index] : links->keyIndex() ) {
      |                        ^~~~~~~~~~~~~~~
LHCb/Event/LinkerEvent/include/Linker/LinkerTable.h:99:24: note: use reference type to prevent copying
   99 |       for ( auto const [source, index] : links->keyIndex() ) {
      |                        ^~~~~~~~~~~~~~~
      |                        &

This MR implements the change the warning suggests.

Merge request reports

Loading