storage/sparse_set: ctor review

This commit is contained in:
Michele Caini
2021-07-07 12:29:39 +02:00
parent 1c5b846488
commit 1baad08288
2 changed files with 21 additions and 11 deletions

View File

@@ -306,6 +306,19 @@ public:
/*! @brief Reverse iterator type. */
using reverse_iterator = std::reverse_iterator<iterator>;
/*! @brief Default constructor. */
basic_sparse_set()
: basic_sparse_set{allocator_type{}}
{}
/**
* @brief Constructs an empty container with a given allocator.
* @param allocator The allocator to use.
*/
explicit basic_sparse_set(const allocator_type &allocator)
: basic_sparse_set{deletion_policy::swap_and_pop, allocator}
{}
/**
* @brief Constructs an empty container with the given policy and allocator.
* @param pol Type of deletion policy.
@@ -321,14 +334,6 @@ public:
mode{pol}
{}
/**
* @brief Constructs an empty container with the given allocator.
* @param allocator Allocator to use (possibly default-constructed).
*/
explicit basic_sparse_set(const allocator_type &allocator = {})
: basic_sparse_set{deletion_policy::swap_and_pop, allocator}
{}
/**
* @brief Move constructor.
* @param other The instance to move from.

View File

@@ -324,11 +324,16 @@ public:
/*! @brief Constant reverse iterator type. */
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
/*! @brief Default constructor. */
basic_storage()
: basic_storage{allocator_type{}}
{}
/**
* @brief Default constructor.
* @param allocator Allocator to use (possibly default-constructed).
* @brief Constructs an empty storage with a given allocator.
* @param allocator the allocator to use.
*/
explicit basic_storage(const allocator_type &allocator = {})
explicit basic_storage(const allocator_type &allocator)
: underlying_type{deletion_policy{comp_traits::in_place_delete::value}, allocator},
bucket{allocator, 0u},
packed{}