Skip to content

Commit a0411d6

Browse files
Philippe-Choletphimuemue
authored andcommitted
CombinationsWithReplacement: use a boxed slice internally
1 parent 8dd75f1 commit a0411d6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/combinations_with_replacement.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use alloc::boxed::Box;
12
use alloc::vec::Vec;
23
use std::fmt;
34
use std::iter::FusedIterator;
@@ -16,7 +17,7 @@ where
1617
I: Iterator,
1718
I::Item: Clone,
1819
{
19-
indices: Vec<usize>,
20+
indices: Box<[usize]>,
2021
pool: LazyBuffer<I>,
2122
first: bool,
2223
}
@@ -46,7 +47,7 @@ where
4647
I: Iterator,
4748
I::Item: Clone,
4849
{
49-
let indices: Vec<usize> = alloc::vec![0; k];
50+
let indices = alloc::vec![0; k].into_boxed_slice();
5051
let pool: LazyBuffer<I> = LazyBuffer::new(iter);
5152

5253
CombinationsWithReplacement {

0 commit comments

Comments
 (0)