Skip to content

Add explicit move assignment operator to Track

Marco Cattaneo requested to merge addTrackMoveAssignment-run2 into run2-patches

This is to mirror what was done in Track::v1 on master, exposed by the following compilation warnings in Rec:

Muon/MuonID/src/component/MuonIDAlg.cpp: In member function 'virtual StatusCode MuonIDAlg::execute()':
Muon/MuonID/src/component/MuonIDAlg.cpp:920:31: warning: implicitly-declared 'LHCb::Track& LHCb::Track::operator=(const LHCb::Track&)' is deprecated [-Wdeprecated-copy]
  920 |       m_mutrack = LHCb::Track();
      |                               ^
In file included from LHCb/InstallArea/x86_64-centos7-gcc9-opt/include/Event/MuonPID.h:14,
                 from Muon/MuonID/src/component/MuonIDAlg.h:26,
                 from Muon/MuonID/src/component/MuonIDAlg.cpp:23:
LHCb/InstallArea/x86_64-centos7-gcc9-opt/include/Event/Track.h:953:8: note: because 'LHCb::Track' has user-provided 'LHCb::Track::Track(const LHCb::Track&)'
  953 | inline LHCb::Track::Track( const LHCb::Track& track )
      |        ^~~~
LHCb/InstallArea/x86_64-centos7-gcc9-opt/include/Event/Track.h: In member function 'LHCb::Track& LHCb::Track::operator=(const LHCb::Track&)':
LHCb/InstallArea/x86_64-centos7-gcc9-opt/include/Event/Track.h:73:9: warning: implicitly-declared 'KeyedObject<int>& KeyedObject<int>::operator=(const KeyedObject<int>&)' is deprecated [-Wdeprecated-copy]
   73 |   class Track : public KeyedObject<int> {
      |         ^~~~~
In file included from Gaudi/InstallArea/x86_64-centos7-gcc9-opt/include/GaudiKernel/KeyedContainer.h:24,
                 from LHCb/InstallArea/x86_64-centos7-gcc9-opt/include/Event/MuonCoord.h:14,
                 from Muon/MuonID/src/component/MuonIDAlg.h:25,
                 from Muon/MuonID/src/component/MuonIDAlg.cpp:23:
Gaudi/InstallArea/x86_64-centos7-gcc9-opt/include/GaudiKernel/KeyedObject.h:93:3: note: because 'KeyedObject<int>' has user-provided 'KeyedObject<K>::KeyedObject(const KeyedObject<K>&) [with KEY = int]'
   93 |   KeyedObject( const KeyedObject& copy ) : ContainedObject( copy ), m_refCount( 0 ), m_hasKey( true ) {}
      |   ^~~~~~~~~~~
Muon/MuonID/src/component/MuonIDAlg.cpp: In member function 'virtual StatusCode MuonIDAlg::execute()':
Muon/MuonID/src/component/MuonIDAlg.cpp:920:31: note: synthesized method 'LHCb::Track& LHCb::Track::operator=(const LHCb::Track&)' first required here
  920 |       m_mutrack = LHCb::Track();
      |                               ^
Muon/MuonID/src/component/MuonIDAlg.cpp: In member function 'StatusCode MuonIDAlg::doID(LHCb::MuonPID*)':
Muon/MuonID/src/component/MuonIDAlg.cpp:1229:44: warning: implicitly-declared 'LHCb::Track& LHCb::Track::operator=(const LHCb::Track&)' is deprecated [-Wdeprecated-copy]
 1229 |     m_mutrack = LHCb::Track( mother->key() );
      |                                            ^
In file included from LHCb/InstallArea/x86_64-centos7-gcc9-opt/include/Event/MuonPID.h:14,
                 from Muon/MuonID/src/component/MuonIDAlg.h:26,
                 from Muon/MuonID/src/component/MuonIDAlg.cpp:23:
LHCb/InstallArea/x86_64-centos7-gcc9-opt/include/Event/Track.h:953:8: note: because 'LHCb::Track' has user-provided 'LHCb::Track::Track(const LHCb::Track&)'
  953 | inline LHCb::Track::Track( const LHCb::Track& track )
      |        ^~~~
Edited by Marco Cattaneo

Merge request reports