Bag
public struct Bag<Element>
An unordered, non-unique collection of values of type Element
.
-
Insert the given value into
self
, and return a token that can later be passed toremove(using:)
.Declaration
Swift
public mutating func insert(_ value: Element) -> RemovalToken
Parameters
value
A value that will be inserted.
-
Remove a value, given the token returned from
insert()
.Note
If the value has already been removed, nothing happens.
Declaration
Swift
public mutating func remove(using token: RemovalToken)
Parameters
token
A token returned from a call to
insert()
.
-
Declaration
Swift
public var startIndex: Index
-
Declaration
Swift
public var endIndex: Index
-
Declaration
Swift
public func index(after i: Index) -> Index
Parameters
i
A valid index of the collection.
i
must be less thanendIndex
.Return Value
The index value immediately after
i
. -
Declaration
Swift
public func makeIterator() -> BagIterator<Element>