Skip to content

Commit 5744eaa

Browse files
committed
Take fileNames by value in InputFileCatalog constructor
The constructor makes a copy of the fileNames anyway. For the cases where InputFileCatalog is constructed with temporary or moved vector<string>, this change allows to avoid copying that vector. The Sources tend to pass in directly a temporary vector<string> from the ParameterSet, so there could be a visible reduction in memory churn.
1 parent 3b2822e commit 5744eaa

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

FWCore/Catalog/interface/InputFileCatalog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace edm {
3333

3434
class InputFileCatalog {
3535
public:
36-
InputFileCatalog(std::vector<std::string> const& fileNames,
36+
InputFileCatalog(std::vector<std::string> fileNames,
3737
std::string const& override,
3838
bool useLFNasPFNifLFNnotFound = false,
3939
//switching between two catalog types

FWCore/Catalog/src/InputFileCatalog.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
namespace edm {
1919

20-
InputFileCatalog::InputFileCatalog(std::vector<std::string> const& fileNames,
20+
InputFileCatalog::InputFileCatalog(std::vector<std::string> fileNames,
2121
std::string const& override,
2222
bool useLFNasPFNifLFNnotFound,
2323
edm::CatalogType catType)
2424
: fileCatalogItems_(), overrideFileLocator_() {
25-
init(fileNames, override, useLFNasPFNifLFNnotFound, catType);
25+
init(std::move(fileNames), override, useLFNasPFNifLFNnotFound, catType);
2626
}
2727

2828
InputFileCatalog::~InputFileCatalog() {}

0 commit comments

Comments
 (0)