preserves the values of the relocated entries, unlikely remove_if. This
allows walking them and erasing them.
Also flesh out the predicate we are using for this to support the
various constraints actually imposed on a UnaryPredicate -- without this
we can't compose it with std::not1.
Thanks to Sean Silva for the review here and noticing the issue with
std::remove_if.
llvm-svn: 165073
/// \returns true if any element is removed.
template <typename UnaryPredicate>
bool remove_if(UnaryPredicate P) {
- typename vector_type::iterator B = std::remove_if(vector_.begin(),
- vector_.end(), P),
+ typename vector_type::iterator B = std::partition(vector_.begin(),
+ vector_.end(),
+ std::not1(P)),
E = vector_.end();
if (B == E)
return false;
const SetType &Set;
public:
+ typedef AllocaInst *argument_type;
+
IsAllocaInSet(const SetType &Set) : Set(Set) {}
- bool operator()(AllocaInst *AI) { return Set.count(AI); }
+ bool operator()(AllocaInst *AI) const { return Set.count(AI); }
};
}