-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[stdlib] Transition InlinedFixedVecor.type
to CollectionElement
#3561
base: nightly
Are you sure you want to change the base?
[stdlib] Transition InlinedFixedVecor.type
to CollectionElement
#3561
Conversation
454037f
to
2e75886
Compare
Signed-off-by: rd4com <144297616+rd4com@users.noreply.github.com>
2e75886
to
0b6ed60
Compare
Would it be possible to use conditional conformance within |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just needs a rebase and a minor organization comment I made wrt to the tests.
Thanks for tackling this!
mutability: Bool, //, | ||
type: CollectionElement, | ||
static_size: Int, | ||
lifetime: Lifetime[mutability].type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion You'll need to rebase since s/Lifetime/Origin
recently
self.current_size = 0 | ||
self.capacity = capacity | ||
|
||
@always_inline | ||
fn __init__(inout self, existing: Self): | ||
fn __copyinit__(inout self, existing: Self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion If you'd like, we could make this conform to ExplicitlyCopyable
too.
|
||
var vector = InlinedFixedVector[MyStruct, 16](1000) | ||
|
||
# assert del |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion Instead of having one long test function with these conceptual different cases, from a maintenance perspective and ease of readability for others, I'd recommend putting each of these test cases in their own function, like so:
def test_destructor():
...
def copy_constructor():
...
def test_move_constructor():
...
def test_move_constructor_no_dynamic():
...
and so on. Thoughts?
This commit is a possible transition for
InlinedFixedVector
,changing it's
type
parameter fromAnyTrivialRegType
toCollectionElement
.It is for a feature request by @JoeLoser:
#3478
Not sure if it is exactly what you had in mind @JoeLoser,
but here is a possible implementation 👍