Add a slot_map::partition(Pred) member function#133
Add a slot_map::partition(Pred) member function#133Quuxplusone wants to merge 2 commits intoWG21-SG14:masterfrom
Conversation
05799bd to
784dbdb
Compare
784dbdb to
284bbfe
Compare
284bbfe to
f6ca140
Compare
Just like the standard `std::partition` algorithm, this member function reorders the slot_map's elements in such a way that all elements for which the predicate `pred` returns `true` precede the elements for which `pred` returns `false`. The relative order of the elements is not preserved. The function returns an iterator to the first element of the second group (which may be `end()`, in the case that all elements belong to the first group). Addresses part of WG21-SG14#131, although I'm not sure whether this really addresses whatever use case @p-groarke is thinking of.
|
TBH, I'm not sure this is need. |
That would be great, but off the top of my head, would |
|
Oh yes your right, that's why we needed this. Sorry, been a long time :) |
| return 1; | ||
| } | ||
|
|
||
| constexpr void underlying_swap(const_iterator cit, const_iterator cjt) { |
There was a problem hiding this comment.
Comment and complexity would be nice to conform to the rest of the header.
| } | ||
|
|
||
| template<class Pred> | ||
| constexpr iterator partition(const Pred& pred) { |
There was a problem hiding this comment.
Comments and complexity would be welcome.
|
@Quuxplusone Please take a look at #147 |
Just like the standard
std::partitionalgorithm, this member functionreorders the slot_map's elements in such a way that all elements for which
the predicate
predreturnstrueprecede the elements for whichpredreturns
false. The relative order of the elements is not preserved.The function returns an iterator to the first element of the second group
(which may be
end(), in the case that all elements belong to the first group).Addresses part of #131, although I'm not sure whether this really addresses
whatever use case @p-groarke is thinking of.