From 40b763481cc7d738cc936614a1cb620cc0e0613d Mon Sep 17 00:00:00 2001 From: tmadlener Date: Tue, 11 Jun 2024 11:24:30 +0200 Subject: [PATCH] Make older compilers happy with in place construction --- include/podio/utilities/RootHelpers.h | 10 ++++++++++ src/ROOTLegacyReader.cc | 2 +- src/ROOTReader.cc | 7 +++---- src/ROOTWriter.cc | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/podio/utilities/RootHelpers.h b/include/podio/utilities/RootHelpers.h index bd8f9a57b..8e3118b4d 100644 --- a/include/podio/utilities/RootHelpers.h +++ b/include/podio/utilities/RootHelpers.h @@ -26,6 +26,16 @@ namespace root_utils { /// write a collection. Needed to cache the branch pointers and avoid having to /// get them from a TTree/TChain for every event. struct CollectionBranches { + CollectionBranches() = default; + ~CollectionBranches() = default; + CollectionBranches(const CollectionBranches&) = delete; + CollectionBranches& operator=(const CollectionBranches&) = delete; + CollectionBranches(CollectionBranches&&) = default; + CollectionBranches& operator=(CollectionBranches&&) = default; + + CollectionBranches(TBranch* dataBranch) : data(dataBranch) { + } + TBranch* data{nullptr}; std::vector refs{}; std::vector vecs{}; diff --git a/src/ROOTLegacyReader.cc b/src/ROOTLegacyReader.cc index 83f160615..494ec4301 100644 --- a/src/ROOTLegacyReader.cc +++ b/src/ROOTLegacyReader.cc @@ -207,7 +207,7 @@ void ROOTLegacyReader::createCollectionBranches(const std::vector, std::vector>> @@ -419,7 +418,7 @@ createCollectionBranches(TChain* chain, const podio::CollectionIDTable& idTable, collBranches.emplace_back(std::move(branches)); } - return {collBranches, storedClasses}; + return {std::move(collBranches), storedClasses}; } } // namespace podio diff --git a/src/ROOTWriter.cc b/src/ROOTWriter.cc index a2056cc6b..df8e810fd 100644 --- a/src/ROOTWriter.cc +++ b/src/ROOTWriter.cc @@ -120,7 +120,7 @@ void ROOTWriter::initBranches(CategoryInfo& catInfo, const std::vectorgetTypeName()), coll->isSubsetCollection(), coll->getSchemaVersion()); }