Skip to content

Commit 0cbab1d

Browse files
committed
uses make_shared in powerset
1 parent 16f5868 commit 0cbab1d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

powerset.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,17 @@ class iter::impl::Powersetter {
5454
Iterator(Container& in_container, std::size_t sz)
5555
: container_p{&in_container},
5656
set_size{sz},
57-
comb{new CombinatorType(combinations(in_container, sz))},
57+
comb{
58+
std::make_shared<CombinatorType>(combinations(in_container, sz))},
5859
comb_iter{std::begin(*comb)},
5960
comb_end{std::end(*comb)} {}
6061

6162
Iterator& operator++() {
6263
++this->comb_iter;
6364
if (this->comb_iter == this->comb_end) {
6465
++this->set_size;
65-
this->comb.reset(new CombinatorType(
66-
combinations(*this->container_p, this->set_size)));
66+
this->comb = std::make_shared<CombinatorType>(
67+
combinations(*this->container_p, this->set_size));
6768
this->comb_iter = std::begin(*this->comb);
6869
this->comb_end = std::end(*this->comb);
6970
}

0 commit comments

Comments
 (0)