Fixes naming.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
b909fc720a
commit
7ec2a3f2b0
|
@ -1,39 +1,39 @@
|
|||
#ifndef ARBUTILS___OPTIONALUNIQUEPTRLIST_HPP
|
||||
#define ARBUTILS___OPTIONALUNIQUEPTRLIST_HPP
|
||||
#ifndef ARBUTILS___OPTIONALOptionalUniquePtrList_HPP
|
||||
#define ARBUTILS___OPTIONALOptionalUniquePtrList_HPP
|
||||
|
||||
#include "__OptionalBorrowedPtr.hpp"
|
||||
|
||||
namespace ArbUt {
|
||||
/// @brief Collection of pointers that is owned by the list. When the list exits scope, the destructor on all
|
||||
/// pointers will be called.
|
||||
template <class ValueT> class UniquePtrList {
|
||||
template <class ValueT> class OptionalUniquePtrList {
|
||||
private:
|
||||
std::vector<ValueT*> _vector;
|
||||
using iterator = typename std::vector<ValueT*>::iterator;
|
||||
using const_iterator = typename std::vector<ValueT*>::const_iterator;
|
||||
|
||||
public:
|
||||
inline UniquePtrList() noexcept : _vector() {}
|
||||
/// @brief Initialises a UniquePtrList from a std::vector of raw pointers.
|
||||
inline OptionalUniquePtrList() noexcept : _vector() {}
|
||||
/// @brief Initialises a OptionalUniquePtrList from a std::vector of raw pointers.
|
||||
/// @param vec A std::vector of raw pointers.
|
||||
inline UniquePtrList(const std::vector<ValueT*>& vec) noexcept : _vector(vec) {}
|
||||
/// @brief Initialises a UniquePtrList with a certain capacity reserved for use. This does not set immediate
|
||||
inline OptionalUniquePtrList(const std::vector<ValueT*>& vec) noexcept : _vector(vec) {}
|
||||
/// @brief Initialises a OptionalUniquePtrList with a certain capacity reserved for use. This does not set immediate
|
||||
/// size.
|
||||
/// @param capacity The desired capacity.
|
||||
explicit inline UniquePtrList(size_t capacity) : _vector() { _vector.reserve(capacity); }
|
||||
/// @brief Initialises a UniquePtrList from a initialiser_list.
|
||||
explicit inline OptionalUniquePtrList(size_t capacity) : _vector() { _vector.reserve(capacity); }
|
||||
/// @brief Initialises a OptionalUniquePtrList from a initialiser_list.
|
||||
/// @param l A initialiser_list
|
||||
inline UniquePtrList(const std::initializer_list<ValueT*>& l) noexcept : _vector(l) {}
|
||||
/// @brief Initialises a UniquePtrList from a raw pointer range.
|
||||
inline OptionalUniquePtrList(const std::initializer_list<ValueT*>& l) noexcept : _vector(l) {}
|
||||
/// @brief Initialises a OptionalUniquePtrList from a raw pointer range.
|
||||
/// @param begin The raw pointer to the start of the list.
|
||||
/// @param end The raw pointer to the end of the list.
|
||||
inline UniquePtrList(ValueT* const* begin, ValueT* const* end) noexcept : _vector(begin, end) {}
|
||||
inline OptionalUniquePtrList(ValueT* const* begin, ValueT* const* end) noexcept : _vector(begin, end) {}
|
||||
|
||||
UniquePtrList(const UniquePtrList<ValueT>&) = delete;
|
||||
UniquePtrList<ValueT>& operator=(const UniquePtrList<ValueT>&) = delete;
|
||||
~UniquePtrList() noexcept { Clear(); }
|
||||
OptionalUniquePtrList(const OptionalUniquePtrList<ValueT>&) = delete;
|
||||
OptionalUniquePtrList<ValueT>& operator=(const OptionalUniquePtrList<ValueT>&) = delete;
|
||||
~OptionalUniquePtrList() noexcept { Clear(); }
|
||||
|
||||
/// @brief Clears the UniquePtrList, and run the destructor on all containing pointers.
|
||||
/// @brief Clears the OptionalUniquePtrList, and run the destructor on all containing pointers.
|
||||
inline void Clear() noexcept {
|
||||
for (auto& i : _vector) {
|
||||
delete i;
|
||||
|
@ -144,4 +144,4 @@ namespace ArbUt {
|
|||
};
|
||||
}
|
||||
|
||||
#endif // ARBUTILS___OPTIONALUNIQUEPTRLIST_HPP
|
||||
#endif // ARBUTILS___OPTIONALOptionalUniquePtrList_HPP
|
||||
|
|
Loading…
Reference in New Issue