This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Data { | |
bool has_property; | |
// ... | |
}; | |
std::vector<Data> data(FillData()); | |
/* | |
Reorders the elements in the range [first, last) in such a way | |
that all elements for which the predicate p returns true precede | |
the elements for which predicate p returns false. Relative order | |
of the elements is not preserved. | |
*/ | |
std::partition(data.begin(), data.end(), [](const Data& other) { | |
// Negation, so that all with property go to the right. | |
return !other.has_property; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment