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

Remove const ref to string_view in codebase #2440

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

Hind-M
Copy link
Member

@Hind-M Hind-M commented Apr 4, 2023

No description provided.

@Hind-M
Copy link
Member Author

Hind-M commented Apr 4, 2023

This makes me wondering about the const:
https://github.com/mamba-org/mamba/blob/main/libmamba/src/core/util_os.cpp#L551
Should we remove it everywhere or leave it?

@AntoinePrv
Copy link
Member

This const is typically not added, but is correct.

For view types, one needs to think like pointers.

  • std::string_view is like char const* -> the inner data is const but we can make the pointer point to something else.
  • const std::string_view is like char const* const -> the inner data is const, and we cannot rebind the pointer.

@AntoinePrv AntoinePrv merged commit 22d37ce into mamba-org:main Apr 5, 2023
@Hind-M Hind-M deleted the string_views branch April 5, 2023 07:57
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.

None yet

2 participants