CombinationsSequence: underestimatedCount == count (#220)

Not doing this makes it needlessly costly to create an Array of the
results.
This commit is contained in:
Dave Abrahams authored and GitHub committed 2024-01-20 10:04:45 -06:00
1 parent c3b3acbca3
commit 9dd88e5eaf
2 files changed
+56 -46

No files matched your search

+4
View File
@@ -78,6 +78,10 @@ public struct CombinationsSequence<Base: Collection> {
binomial(n: n, k: $0)
}.reduce(0, +)
}
/// The total number of combinations.
@inlinable
public var underestimatedCount: Int { count }
}
extension CombinationsSequence: Sequence {