File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,8 @@ struct ContainerHandle {
138
138
139
139
/* implicit*/ ContainerHandle(container_type* c) : handle(c) {}
140
140
141
+ /* implicit*/ ContainerHandle(std::unique_ptr<container_type> c) : handle(std::move(c)) {}
142
+
141
143
void set_leaf (leaf_type* leaf) {
142
144
pytree_assert (handle->kind == Kind::Leaf);
143
145
handle->leaf = leaf;
@@ -485,10 +487,10 @@ TreeSpec<Aux> from_str_internal(
485
487
read_idx++;
486
488
auto layout = read_node_layout (spec, read_idx);
487
489
const auto size = layout.size ();
488
- auto c = new TreeSpecContainer<Aux>(kind, size);
490
+ auto c = std::make_unique< TreeSpecContainer<Aux> >(kind, size);
489
491
490
492
if (Kind::Custom == kind) {
491
- c->custom_type = custom_type;
493
+ c->custom_type = std::move ( custom_type) ;
492
494
}
493
495
494
496
size_t child_idx = 0 ;
@@ -515,7 +517,7 @@ TreeSpec<Aux> from_str_internal(
515
517
read_idx++;
516
518
auto layout = read_node_layout (spec, read_idx);
517
519
const auto size = layout.size ();
518
- auto c = new TreeSpecContainer<Aux>(Kind::Dict, size);
520
+ auto c = std::make_unique< TreeSpecContainer<Aux> >(Kind::Dict, size);
519
521
520
522
size_t child_idx = 0 ;
521
523
size_t leaves_offset = 0 ;
You can’t perform that action at this time.
0 commit comments