3.1.4. shared_ptr.hpp

Full path: allocator/shared_ptr.hpp

template<typename Perm>
class shared_ptr_allocator

An Allocator using reference-counting to guarantee no memory leaks, even when release is not used correctly.

using perm = Perm
using pointer = std::shared_ptr<perm>
using const_pointer = std::shared_ptr<const perm>
explicit shared_ptr_allocator(std::size_t n)

Construct an allocator that allocates permutations of degree n.

std::size_t degree() const
pointer make()
Returns

std::make_shared<perm>(perm_group::make_perm<perm>(degree()))

pointer make_identity()
Returns

std::make_shared<perm>(perm_group::make_identity_perm<perm>(degree()))

template<typename UPerm>
pointer copy(UPerm &&p)
Returns

std::make_shared<perm>(perm_group::copy_perm<perm>(std::forward<UPerm>(p)))

void release(const_pointer p)

Does nothing, though at this stage p should be the sole reference to the permutation.