Skip to content

Commit 3474460

Browse files
Make MapMonoid underlying type Clone
1 parent ded9a93 commit 3474460

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/lazysegtree.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::Monoid;
33

44
pub trait MapMonoid {
55
type M: Monoid;
6-
type F: Copy;
6+
type F: Clone;
77
// type S = <Self::M as Monoid>::S;
88
fn identity_element() -> <Self::M as Monoid>::S {
99
Self::M::identity()
@@ -274,14 +274,14 @@ where
274274
self.d[k] = F::binary_operation(self.d[2 * k].clone(), self.d[2 * k + 1].clone());
275275
}
276276
fn all_apply(&mut self, k: usize, f: F::F) {
277-
self.d[k] = F::mapping(f, self.d[k].clone());
277+
self.d[k] = F::mapping(f.clone(), self.d[k].clone());
278278
if k < self.size {
279-
self.lz[k] = F::composition(f, self.lz[k]);
279+
self.lz[k] = F::composition(f, self.lz[k].clone());
280280
}
281281
}
282282
fn push(&mut self, k: usize) {
283-
self.all_apply(2 * k, self.lz[k]);
284-
self.all_apply(2 * k + 1, self.lz[k]);
283+
self.all_apply(2 * k, self.lz[k].clone());
284+
self.all_apply(2 * k + 1, self.lz[k].clone());
285285
self.lz[k] = F::identity_map();
286286
}
287287
}

0 commit comments

Comments
 (0)