Got compiler error on reverse...clone is how to fix... #16095
David-Worboys
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an array of structs that I wanted to reverse and the compiler threw a tanty..Code is to big to post here and as I have a fix I am not going to make an example. Info below might help someone
fn (mut iptc Iptc) add_current_properties(mut iptc_tags []Tag, amendments_dict map[string]Tag) Error_Status {
And I wanted to reverse iptc_tags
for iptc_tag in iptc_tags.reverse() { // ignore new additions }
Which resulted in
The fix was to clone before reversing...
for iptc_tag in iptc_tags.clone().reverse() { // ignore new additions }
Beta Was this translation helpful? Give feedback.
All reactions