Refactor Blocked class to meet allocator requirements#351
Merged
Conversation
rfsaliev
requested review from
ahuber21,
ibhati,
mihaic and
yuejiaointel
as code owners
July 13, 2026 09:35
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors svs::data::Blocked<Alloc> (public header) to inherit from its allocator type rather than storing it as a member, aiming to better align Blocked with allocator conventions while preserving access to BlockingParameters.
Changes:
Blockednow derives fromAllocand returns the allocator via*thisrather than a stored member.Blockedintroduces avalue_typealias viastd::allocator_traits.- The
Blockedallocator test switches from anint“allocator” to a struct withvalue_type.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| include/svs/core/data/simple.h | Refactors Blocked to inherit from Alloc and updates constructors/accessors accordingly. |
| tests/svs/core/data/block.cpp | Updates the allocator-propagation test to use a struct-based “allocator” type. |
yuejiaointel
approved these changes
Jul 16, 2026
yuejiaointel
left a comment
Contributor
There was a problem hiding this comment.
LGTM, understanding is using class instead of field saves memory because field costs at least 1 byte and class can be empty.
|
Tick the box to add this pull request to the merge queue (same as
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request refactors the
Blockedclass template to inherit from its allocator type instead of storing it as a member, and updates the associated test to use a struct-based allocator. This change simplifies allocator handling and improves compatibility with standard allocator patterns.Core class refactoring:
Blockednow inherits from its allocator type (Alloc) instead of storing anAlloc allocator_member, which simplifies construction, copying, and access to the allocator. Theget_allocator()method now returns*this(as an allocator), and constructors have been updated accordingly.Test improvements:
Blockedwith an allocator has been updated to use a struct-based allocator (I), which provides avalue_typeand integer value for testing propagation and compatibility with the new inheritance-based implementation.