Skip to content
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

Fix compilation: use reference in loop, not copy #39763

Merged

Conversation

anothersimulacrum
Copy link
Member

Summary

SUMMARY: None

Purpose of change

src/advanced_inv.cpp:823:38: error: loop variable 'elem' of type 'const advanced_inv_listitem' creates a copy from type 'const advanced_inv_listitem' [-Werror,-Wrange-loop-construct]
    for( const advanced_inv_listitem elem : spane.items ) {
                                     ^
src/advanced_inv.cpp:823:10: note: use reference type 'const advanced_inv_listitem &' to prevent copying
    for( const advanced_inv_listitem elem : spane.items ) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                     &
1 error generated.

Describe the solution

Make a reference

Testing

It compiles.

@ZhilkinSerg ZhilkinSerg merged commit 739080a into CleverRaven:master Apr 20, 2020
@anothersimulacrum anothersimulacrum deleted the Wrange-loop-construct branch April 20, 2020 20:02
@leycec leycec mentioned this pull request Dec 9, 2020
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants