Fixes naming.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-12-12 11:57:47 +01:00
parent b909fc720a
commit 7ec2a3f2b0
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 17 additions and 17 deletions

View File

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