Skip to content

How to convert Array<T> to Vec<T>? #359

Answered by 3togo
3togo asked this question in Q&A
Oct 21, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

fn to_vec<T:HasAfEnum+Default+Clone>(array:&Array) -> Vec {
let mut vec = vec!(T::default();array.elements());
array.host(&mut vec);
return vec;
}

After calling function host, will vec still in gpu memory?

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@9prady9
Comment options

@3togo
Comment options

Answer selected by 9prady9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants