// the contents of v are blown out void ExplicitBitVect::getOnBits (IntVect& v) const { unsigned int nOn = getNumOnBits(); if(!v.empty()) IntVect().swap(v); v.reserve(nOn); for(unsigned int i=0;i<d_size;i++){ if((bool)(*dp_bits)[i]) v.push_back(i); } };
// """ ------------------------------------------------------- // // getOnBits(IntVect &which) // C++: Passes the set of on bits out in the IntVect passed in. // The contents of IntVect are destroyed. // // Python: Returns the tuple of on bits // // """ ------------------------------------------------------- void SparseBitVect::getOnBits(IntVect &v) const { if (!dp_bits) { throw ValueErrorException("BitVect not properly initialized."); } unsigned int nOn = getNumOnBits(); if (!v.empty()) IntVect().swap(v); v.reserve(nOn); v.resize(nOn); std::copy(dp_bits->begin(), dp_bits->end(), v.begin()); };