Skip to content

Move STL-like container headers to core/stl/containers#744

Open
Spartan322 wants to merge 1 commit into
masterfrom
add/stl-like-containers
Open

Move STL-like container headers to core/stl/containers#744
Spartan322 wants to merge 1 commit into
masterfrom
add/stl-like-containers

Conversation

@Spartan322
Copy link
Copy Markdown
Member

@Spartan322 Spartan322 commented May 20, 2026

Includes:

  • CowPtr
  • CowVector
  • FixedVector
  • RingBuffer
  • StackString
  • TypedSpan

Move allocator aware STL-like containers to OpenVic::stl namespace
Includes:

  • CowPtr
  • CowVector
  • FixedVector
  • RingBuffer

Move BasicIterator to core/stl
Move TslHelper.hpp to core/stl and rename to MutableIterator.hpp

Move memory container type aliases to core/memory

Add memory type alias for cow_ptr
Add memory type alias for cow_vector

Move FixedVector from namespace OpenVic::_detail to OpenVic::stl

Add stateful allocator support to FixedVector's constructors

Replace assert in TypedSpan with OV_HARDEN_ASSERT_ACCESS

Move STL-like container unit tests to core/stl/containers

@Spartan322 Spartan322 requested a review from a team as a code owner May 20, 2026 06:05
@Spartan322 Spartan322 force-pushed the add/stl-like-containers branch 2 times, most recently from 45f5685 to 6fd5c56 Compare May 20, 2026 06:11
Comment thread src/openvic-simulation/core/memory/CowPtr.hpp Outdated
Comment thread src/openvic-simulation/core/memory/FixedVector.hpp
Comment thread src/openvic-simulation/core/memory/RingBuffer.hpp
Comment thread src/openvic-simulation/core/stl/containers/TunableVector.hpp Outdated
Comment thread src/openvic-simulation/core/memory/TunableVector.hpp Outdated
Comment thread src/openvic-simulation/core/portable/ForwardableSpan.hpp
Comment thread src/openvic-simulation/core/stl/containers/CowVector.hpp
Comment thread src/openvic-simulation/core/stl/containers/FixedVector.hpp Outdated
Comment thread src/openvic-simulation/core/stl/containers/TypedSpan.hpp Outdated
Comment thread src/openvic-simulation/core/stl/containers/TypedSpan.hpp
Comment thread src/openvic-simulation/types/Signal.hpp
Comment thread tests/src/core/stl/containers/FixedVector.cpp Outdated
Copy link
Copy Markdown
Contributor

@wvpm wvpm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall a step in the right direction.
Move tunable_vector to a separate PR. It has nothing to do with this.
Besides that, it just need some import fixes.

@Spartan322 Spartan322 force-pushed the add/stl-like-containers branch from 6fd5c56 to b3f4817 Compare May 20, 2026 11:20
@Spartan322 Spartan322 force-pushed the add/stl-like-containers branch 2 times, most recently from bdb5122 to 0c289ed Compare May 20, 2026 16:25
@Spartan322 Spartan322 requested a review from wvpm May 20, 2026 16:28
Includes:
	- CowPtr
	- CowVector
	- FixedVector
	- RingBuffer
	- StackString
	- TypedSpan

Move allocator aware STL-like containers to `OpenVic::stl` namespace
Includes:
	- CowPtr
	- CowVector
	- FixedVector
	- RingBuffer

Move BasicIterator to `core/stl`
Move TslHelper.hpp to `core/stl` and rename to MutableIterator.hpp

Move memory container type aliases to `core/memory`

Add memory type alias for cow_ptr
Add memory type alias for cow_vector

Move FixedVector from namespace `OpenVic::_detail` to `OpenVic::stl`

Add stateful allocator support to FixedVector's constructors

Replace assert in TypedSpan with `OV_HARDEN_ASSERT_ACCESS`

Move STL-like container unit tests to `core/stl/containers`
@Spartan322 Spartan322 force-pushed the add/stl-like-containers branch from 0c289ed to b2c561e Compare May 20, 2026 16:39
_allocator(),
_data_start_ptr(allocator_traits::allocate(_allocator, capacity)) {}

constexpr FixedVector(const size_t capacity, std::type_identity_t<Allocator> const& alloc)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to either generate values, use a provided value that you can copy or create it empty based on the constructor tags.

Copy link
Copy Markdown
Contributor

@wvpm wvpm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support constructor tags in FixedVector and this is ready for merge 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants