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

Range iteration is always const #21

Open
glebm opened this issue Aug 11, 2022 · 0 comments
Open

Range iteration is always const #21

glebm opened this issue Aug 11, 2022 · 0 comments

Comments

@glebm
Copy link
Contributor

glebm commented Aug 11, 2022

tsl::sparse_map<int, std::string> m;
for (auto &it : m) {
	std::string &value = it.second;
}

This fails with tsl but works with std::unordered_map.

This is documented in README.md but there doesn't seem to be anything making this impossible in principle.

glebm added a commit to glebm/devilutionX that referenced this issue Aug 11, 2022
A couple of minor changes are needed to work around constness issues
in tsl::sparse_map:

1. Tessil/sparse-map#20
2. Tessil/sparse-map#21
glebm added a commit to glebm/devilutionX that referenced this issue Jan 16, 2023
A couple of minor changes are needed to work around constness issues
in tsl::sparse_map:

1. Tessil/sparse-map#20
2. Tessil/sparse-map#21

Memory savings example, Spanish translations map:
296 KiB -> 263 KiB (-33 KiB)

RG99 binary size: +36 KiB
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

No branches or pull requests

1 participant