Add tunable_vector std::vector wrapper container#746
Conversation
0c289ed to
b2c561e
Compare
d00c51f to
27db712
Compare
It shouldn't depend on that based on the code I read. |
| constexpr void append_range(RangeT&& range) { | ||
| if constexpr (std::ranges::forward_range<RangeT> || std::ranges::sized_range<RangeT>) { | ||
| reserve_minimum(std::ranges::distance(range)); | ||
| std::ranges::move(range, std::back_inserter(*this)); |
There was a problem hiding this comment.
Not ranges v3?
or std::uninitialized_copy + resize?
There was a problem hiding this comment.
Can't do uninitialized_copy, would require handling allocations manually, which I could do, but I'd rather defer that for later unless requested.
There was a problem hiding this comment.
I thought there was a cross platform issue with ranges and that's why we generaly use ranges v3, is that no longer the case?
| } | ||
|
|
||
| if (value > new_capacity) { | ||
| return value; |
There was a problem hiding this comment.
This seems wrong.
Say you reserve for value and fill it to or near value then add 1-3 elements, it would have to reallocate again.
It would make more sense if it:
- reserves for value + buffer size
- reserves for value x factor
- reserves for smallest factor^n that fits value (+ buffer)
There was a problem hiding this comment.
Only specifically in the case that you reserve more than the next factor size, this is what all the standard libraries will do with resize.
d4bc84c to
db3fe7f
Compare
27db712 to
9516014
Compare
db3fe7f to
f94003a
Compare
It doesn't rely on any code from there but I set it to depend specifically because it relies on the organization from that PR. Also the alias description is saying what its doing, it does add a memory alias for the tunable_vector type, that's that is going on in |
c6fa092 to
900c58b
Compare
f94003a to
069ae75
Compare
900c58b to
aa6c10a
Compare
069ae75 to
ecb7ae0
Compare
aa6c10a to
f2b7c03
Compare
ecb7ae0 to
b8ffe2c
Compare
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`
Add tunable_vector memory alias to `core/memory`
f2b7c03 to
4e5d027
Compare
core/stl/containers#744Add tunable_vector memory alias to
core/memory