Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced some deprecated std functions #25521

Merged
merged 3 commits into from Jan 9, 2019
Merged

Replaced some deprecated std functions #25521

merged 3 commits into from Jan 9, 2019

Conversation

guitargeek
Copy link
Contributor

Part of my occasional PRs to modernize CMSSW.

I propose to replace the deprecated std::not1, std::not2, std::mem_fun_ref, std::result_of in CMSSW with what is recommended in modern C++ (std::mem_fn, std::not_fn and std::invoke_result).

Local matrix tests pass.

@cmsbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@andrius-k
Copy link

please test

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 19, 2018

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/32277/console Started: 2018/12/19 18:11

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @guitargeek (Jonas Rembser) for master.

It involves the following packages:

DQMOffline/JetMET
HLTrigger/JetMET
PhysicsTools/MVATrainer
RecoEgamma/EgammaTools
RecoTauTag/RecoTau
RecoTracker/CkfPattern
TopQuarkAnalysis/TopHitFit

@perrotta, @cmsbuild, @andrius-k, @kmaeshima, @fwyzard, @schneiml, @Martin-Grunewald, @jfernan2, @slava77, @santocch can you please review it and eventually sign? Thanks.
@TaiSakuma, @felicepantaleo, @jainshilpi, @rappoccio, @Martin-Grunewald, @ahinzmann, @varuns23, @seemasharmafnal, @mmarionncern, @kreczko, @imarches, @makortel, @smoortga, @acaudron, @lgray, @jdolen, @ferencek, @rociovilar, @Sam-Harper, @GiacomoSguazzoni, @rovere, @VinInn, @jdamgov, @nhanvtran, @gkasieczka, @schoef, @mschrode, @ebrondol, @dgulhan, @clelange, @HeinerTholen, @JyothsnaKomaragiri, @mverzett, @gpetruc, @mariadalfonso, @pvmulder this is something you requested to watch as well.
@davidlange6, @slava77, @fabiocos you are the release manager for this.

cms-bot commands are listed here

@@ -29,21 +29,12 @@ class AlphaT {
};


// -----------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you remove this constructor ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the constructor does not have to look different anymore for pointer types: std::men_fn is basically the generalization of std::mem_fun and std::men_fun_ref.

From https://en.cppreference.com/w/cpp/utility/functional/mem_fn:

Both references and pointers (including smart pointers) to an object can be used when invoking a std::mem_fn.

I hope I understood this correctly...

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-25521/32277/summary.html

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 33
  • DQMHistoTests: Total histograms compared: 3153717
  • DQMHistoTests: Total failures: 8
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3153505
  • DQMHistoTests: Total skipped: 204
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 32 files compared)
  • Checked 137 log files, 14 edm output root files, 33 DQM output files

// Wrap function in std::funtion such that member function pointers and other
// functions (lambdas, normal functions, etc.) can be used in the same way
std::function<double(CandidateType const&)> stdFunction{ function };
for(auto const& x : cands) output.push_back(stdFunction(removeRef(x)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does std::decay simplify this at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with that one and didn't understand immediately how it would help here even after googling. You think it could replace this removeRef helper, or are you talking about the step with the generalization for member functions and free functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway I'll experiment a bit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have an explicit solution in mind.
Given most recent updates, perhaps https://en.cppreference.com/w/cpp/types/remove_pointer is more inspirational

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, this also exists! But it does not work with edm::Ptr I imagine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, admittedly, my last comment is going a bit in the backward direction from what is in the PR now and implicitly suggests adding back an equivalent of removeRef(x) which returns the same for bare T and Ptr<T>.
It's more practical to add this adaptor than to reimplement the body of the loop

@smuzaffar smuzaffar removed this from the CMSSW_10_4_X milestone Dec 20, 2018
@fabiocos
Copy link
Contributor

fabiocos commented Jan 8, 2019

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 8, 2019

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/32453/console Started: 2019/01/08 09:48

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 8, 2019

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 8, 2019

Comparison job queued.

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 8, 2019

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-25521/32453/summary.html

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 33
  • DQMHistoTests: Total histograms compared: 3153717
  • DQMHistoTests: Total failures: 1
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3153512
  • DQMHistoTests: Total skipped: 204
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 32 files compared)
  • Checked 137 log files, 14 edm output root files, 33 DQM output files

@fabiocos
Copy link
Contributor

fabiocos commented Jan 9, 2019

code-checks

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 9, 2019

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 9, 2019

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-25521/7883

  • This PR adds an extra 52KB to repository

@fabiocos
Copy link
Contributor

fabiocos commented Jan 9, 2019

+1

@fabiocos
Copy link
Contributor

fabiocos commented Jan 9, 2019

merge

@cmsbuild cmsbuild merged commit ee77e31 into cms-sw:master Jan 9, 2019
@guitargeek guitargeek deleted the not_mem_fun branch January 11, 2019 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants