Style fixes.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-09-24 21:02:22 +02:00
parent 2e93cd65c5
commit 74d7e23056
6 changed files with 16 additions and 11 deletions

View File

@@ -27,7 +27,7 @@ namespace ArbUt {
/// @brief Copy operator.
inline BorrowedPtr<T>& operator=(const BorrowedPtr<T>& rhs) noexcept {
if(this == &rhs)
if (this == &rhs)
return *this;
_raw = rhs._raw;
return *this;

View File

@@ -8,7 +8,8 @@
#include "BorrowedPtr.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.
/// @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 {
private:
std::vector<ValueT*> _vector;
@@ -20,7 +21,8 @@ namespace ArbUt {
/// @brief Initialises a UniquePtrList 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 size.
/// @brief Initialises a UniquePtrList 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.
@@ -55,7 +57,8 @@ namespace ArbUt {
#endif
return _vector[index];
}
/// @brief Returns a raw pointer at an index, and releases ownership. Proper handling of the memory is assumed to be done by the taker.
/// @brief Returns a raw pointer at an index, and releases ownership. Proper handling of the memory is assumed
/// to be done by the taker.
/// @param index The index to get the pointer from.
/// @return A raw pointer.
ValueT* TakeOwnership(size_t index) {
@@ -71,7 +74,8 @@ namespace ArbUt {
_vector[indexA] = _vector[indexB];
_vector[indexB] = temp;
}
/// @brief Sets a pointer to a certain index. If an item already existed at that index, it's destructor will be called.
/// @brief Sets a pointer to a certain index. If an item already existed at that index, it's destructor will be
/// called.
/// @param index The index to set the pointer to.
/// @param ptr The pointer to store.
void Set(size_t index, ValueT* ptr) {