How to store Struct(or string) into DynamicVector
I want to store struct into DynamicVector at first I tried
then I tried to change String Pointer[UInt8] now I do not know how to load string into Pointer[UInt8]
6 Replies
you can do it using pointers:
There is also the example in llama2.mojo:
PointerString is the same alias (
Pointer[UInt8]
) in that repo as in your example here.GitHub
llama2.mojo/llama2.mojo at master · tairov/llama2.mojo
Inference Llama 2 in one file of pure 🔥. Contribute to tairov/llama2.mojo development by creating an account on GitHub.
Congrats @Michael K, you just advanced to level 1!
Thanks for the responses,
I tried @NKspartan example and it is working,
But when I tried to write 2 helper function it does not work anymore what I've done wrong?
In
__copyinit__
you have self.name = other.id
. This should be self.name = other.name
.Thanks a lot, silly mistake 🙂