Browse Source

Filter std::vector by bitvector, could not find such a method before :/

Former-commit-id: b401646d07f78d99bebeb436520b0c20f34ba1bc
tempestpy_adaptions
sjunges 9 years ago
parent
commit
f914c8a103
  1. 11
      src/utility/vector.h

11
src/utility/vector.h

@ -654,6 +654,17 @@ namespace storm {
return resultVector;
}
template<typename Type>
std::vector<Type> filterVector(std::vector<Type> const& in, storm::storage::BitVector const& filter) {
std::vector<Type> result;
result.reserve(filter.getNumberOfSetBits());
for(auto index : filter) {
result.push_back(in[index]);
}
assert(result.size() == filter.getNumberOfSetBits());
return result;
}
} // namespace vector
} // namespace utility
} // namespace storm
Loading…
Cancel
Save