We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I wanted to delete a element one by one from MultiSet and MultiMap. However, Erase(K) delete all elements having key K.
MultiSet
MultiMap
Erase(K)
K
Using EraseIter(iter), we can delete the element one by one.
EraseIter(iter)
package main import ( "fmt" "github.com/liyue201/gostl/ds/set" "github.com/liyue201/gostl/utils/comparator" ) func main() { ms := set.NewMultiSet(comparator.IntComparator) // Insert for i := 0; i < 3; i++ { ms.Insert(5000) } fmt.Println(ms) // [5000 5000 5000] // EraseIter (one element) it := ms.Find(5000) ms.EraseIter(it) fmt.Println(ms) // [5000 5000] // Erase (all elements) ms.Erase(5000) fmt.Println(ms) // [] }
Map already have had EraseIter, so I did nothing to that.
Map
EraseIter
I am ready to send a pull request related this issue. If you approve of this feature addition, I will send that to this repository.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Motivation
I wanted to delete a element one by one from
MultiSet
andMultiMap
. However,Erase(K)
delete all elements having keyK
.Solution
Using
EraseIter(iter)
, we can delete the element one by one.Example
Other little things
Map
already have hadEraseIter
, so I did nothing to that.I am ready to send a pull request related this issue. If you approve of this feature addition, I will send that to this repository.
The text was updated successfully, but these errors were encountered: