Add StackVector implementation - stack-allocated vector with heap fallback #153
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 Implementation Summary
This PR adds a high-performance
StackVectorimplementation that provides a stack-allocated alternative tostd::vectorwith automatic heap fallback, as requested in issue #147.✨ Key Features
std::vectorwith iterators and standard methods📊 Performance Results
Performance testing shows significant improvements over
std::vectorfor typical use cases:std::vectorstd::vectorstd::vector🏗️ Implementation Details
Core Components
StackVector.h: Main implementation with hybrid stack/heap storageStackVectorTests.cpp: Comprehensive unit tests covering all functionalityStackVectorBenchmark.cpp: Performance comparison tests againststd::vectorKey Methods
std::vectormethods:push_back,pop_back,insert,erase, etc.begin(),end(),rbegin(),rend()with const variantsreserve(),resize(),shrink_to_fit(),capacity()is_using_stack(),stack_capacity()Usage Example
🧪 Testing
The implementation includes extensive test coverage:
std::vector🎯 Use Cases
This implementation is particularly beneficial for:
📝 Integration
The
StackVectoris automatically included inPlatform.Collections.hand is available in thePlatform::Collectionsnamespace. All tests are integrated into the existing test suite.Fixes #147
🤖 Generated with Claude Code