diff --git a/AK/Forward.h b/AK/Forward.h index 081333ebd9..69f2222d7f 100644 --- a/AK/Forward.h +++ b/AK/Forward.h @@ -112,12 +112,6 @@ class NonnullRefPtr; template class NonnullOwnPtr; -template -class NonnullOwnPtrVector; - -template -class NonnullRefPtrVector; - template class Optional; @@ -125,9 +119,6 @@ class Optional; template class NonnullLockRefPtr; -template -class NonnullLockRefPtrVector; - template struct LockRefPtrTraits; @@ -182,9 +173,7 @@ using AK::JsonValue; using AK::LittleEndianInputBitStream; using AK::LittleEndianOutputBitStream; using AK::NonnullOwnPtr; -using AK::NonnullOwnPtrVector; using AK::NonnullRefPtr; -using AK::NonnullRefPtrVector; using AK::Optional; using AK::OwnPtr; using AK::ReadonlyBytes; @@ -212,7 +201,6 @@ using AK::Vector; using AK::LockRefPtr; using AK::LockRefPtrTraits; using AK::NonnullLockRefPtr; -using AK::NonnullLockRefPtrVector; # endif #endif diff --git a/AK/NonnullOwnPtrVector.h b/AK/NonnullOwnPtrVector.h deleted file mode 100644 index d6116a6893..0000000000 --- a/AK/NonnullOwnPtrVector.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2018-2020, Andreas Kling - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include - -namespace AK { - -template -class NonnullOwnPtrVector : public NonnullPtrVector, inline_capacity> { -}; - -} - -#if USING_AK_GLOBALLY -using AK::NonnullOwnPtrVector; -#endif diff --git a/AK/NonnullPtrVector.h b/AK/NonnullPtrVector.h deleted file mode 100644 index 1023b91521..0000000000 --- a/AK/NonnullPtrVector.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018-2023, Andreas Kling - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include - -namespace AK { - -template -class NonnullPtrVector : public Vector { - using T = typename PtrType::ElementType; - using Base = Vector; - -public: - NonnullPtrVector() = default; - - NonnullPtrVector(Vector&& other) - : Base(static_cast(other)) - { - } - NonnullPtrVector(Vector const& other) - : Base(static_cast(other)) - { - } - NonnullPtrVector(std::initializer_list list) - : Base(list) - { - } - - using Base::size; - - using ConstIterator = SimpleIterator; - using Iterator = SimpleIterator; - using ReverseIterator = SimpleReverseIterator; - using ReverseConstIterator = SimpleReverseIterator; - - ALWAYS_INLINE constexpr ConstIterator begin() const { return ConstIterator::begin(*this); } - ALWAYS_INLINE constexpr Iterator begin() { return Iterator::begin(*this); } - ALWAYS_INLINE constexpr ReverseIterator rbegin() { return ReverseIterator::rbegin(*this); } - ALWAYS_INLINE constexpr ReverseConstIterator rbegin() const { return ReverseConstIterator::rbegin(*this); } - - ALWAYS_INLINE constexpr ConstIterator end() const { return ConstIterator::end(*this); } - ALWAYS_INLINE constexpr Iterator end() { return Iterator::end(*this); } - ALWAYS_INLINE constexpr ReverseIterator rend() { return ReverseIterator::rend(*this); } - ALWAYS_INLINE constexpr ReverseConstIterator rend() const { return ReverseConstIterator::rend(*this); } - - ALWAYS_INLINE constexpr auto in_reverse() { return ReverseWrapper::in_reverse(*this); } - ALWAYS_INLINE constexpr auto in_reverse() const { return ReverseWrapper::in_reverse(*this); } - - Optional find_first_index(T const& value) const - { - if (auto const index = AK::find_index(begin(), end(), value); - index < size()) { - return index; - } - return {}; - } - - ALWAYS_INLINE PtrType& ptr_at(size_t index) const { return const_cast(Base::at(index)); } - - ALWAYS_INLINE T& at(size_t index) const { return const_cast(*Base::at(index)); } - ALWAYS_INLINE T& operator[](size_t index) const { return at(index); } - ALWAYS_INLINE T& first() const { return at(0); } - ALWAYS_INLINE T& last() const { return at(size() - 1); } - -private: - // NOTE: You can't use resize() on a NonnullFooPtrVector since making the vector - // bigger would require being able to default-construct NonnullFooPtrs. - // Instead, use shrink(new_size). - void resize(size_t) = delete; -}; - -} diff --git a/AK/NonnullRefPtrVector.h b/AK/NonnullRefPtrVector.h deleted file mode 100644 index a012e2d58e..0000000000 --- a/AK/NonnullRefPtrVector.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2018-2020, Andreas Kling - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include - -namespace AK { - -template -class NonnullRefPtrVector : public NonnullPtrVector, inline_capacity> { - using NonnullPtrVector, inline_capacity>::NonnullPtrVector; -}; - -} - -#if USING_AK_GLOBALLY -using AK::NonnullRefPtrVector; -#endif diff --git a/Kernel/Library/NonnullLockRefPtrVector.h b/Kernel/Library/NonnullLockRefPtrVector.h deleted file mode 100644 index dea5ad2fc0..0000000000 --- a/Kernel/Library/NonnullLockRefPtrVector.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2018-2022, Andreas Kling - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include - -namespace AK { - -template -class NonnullLockRefPtrVector : public NonnullPtrVector, inline_capacity> { - using NonnullPtrVector, inline_capacity>::NonnullPtrVector; -}; - -} - -using AK::NonnullLockRefPtrVector;