MCPcopy Create free account
hub / github.com/arq5x/bedtools2 / GetDistinct

Method GetDistinct

src/utils/VectorOps/VectorOps.cpp:255–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255string VectorOps::GetDistinct(void)
256{
257 ostringstream distinct;
258 // remove duplicate entries from the vector
259 // http://stackoverflow.com/questions/1041620/most-efficient-way-to-erase-duplicates-and-sort-a-c-vector
260 sort( _vecs.begin(), _vecs.end() );
261 _vecs.erase( unique( _vecs.begin(), _vecs.end() ), _vecs.end() );
262
263 for( size_t i = 0; i < _vecs.size(); i++ ) {
264 if (i>0)
265 distinct << _delimStr;
266 distinct << _vecs[i];
267 }
268 return distinct.str();
269}
270
271string VectorOps::GetDistinctSortNum(bool ascending)
272{

Callers

nothing calls this directly

Calls 5

eraseMethod · 0.80
strMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected