/usr/include/vcflib/join.h is in libvcflib-dev 1.0.0~rc1+dfsg1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #ifndef __JOIN_H
#define __JOIN_H
// functions to split a string by a specific delimiter
#include <string>
#include <vector>
#include <sstream>
#include <string.h>
// join a vector of elements by a delimiter object. ostream<< must be defined
// for both class S and T and an ostream, as it is e.g. in the case of strings
// and character arrays
template<class S, class T>
std::string join(std::vector<T>& elems, S& delim) {
std::stringstream ss;
typename std::vector<T>::iterator e = elems.begin();
ss << *e++;
for (; e != elems.end(); ++e) {
ss << delim << *e;
}
return ss.str();
}
// same for lists
template<class S, class T>
std::string join(std::list<T>& elems, S& delim) {
std::stringstream ss;
typename std::list<T>::iterator e = elems.begin();
ss << *e++;
for (; e != elems.end(); ++e) {
ss << delim << *e;
}
return ss.str();
}
#endif
|