/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
MagneticField/GeomBuilder/src/printUniqueNames.cc
29 строк
862 B
Carl Vuosalo
Push since IB has expired -- need to rebase. Addressing PR comments, but not compiling yet.
05 сен 2019, 22:04
05 сен 2019, 22:04
a9ff173
Код
Авторство
О чём код?
#include "printUniqueNames.h" #include <iostream> #include <iterator> #include <iomanip> using namespace std; void magneticfield::printUniqueNames(handles::const_iterator begin, handles::const_iterator end, bool uniq) { std::vector<std::string> names; for (handles::const_iterator i = begin; i != end; ++i) { if (uniq) names.push_back((*i)->name); else names.push_back((*i)->name + ":" + std::to_string((*i)->copyno)); } sort(names.begin(), names.end()); if (uniq) { std::vector<std::string>::iterator i = unique(names.begin(), names.end()); int nvols = int(i - names.begin()); cout << nvols << " "; copy(names.begin(), i, ostream_iterator<std::string>(cout, " ")); } else { cout << names.size() << " "; copy(names.begin(), names.end(), ostream_iterator<std::string>(cout, " ")); } cout << endl; }