serge-sans-paille / frozen

a header-only, constexpr alternative to gperf for C++14 users
Apache License 2.0
1.31k stars 104 forks source link

#105 Add non-const functions to map and unordered_map that allow value modification #106

Closed peter-moran closed 3 years ago

peter-moran commented 3 years ago

As discussed in #105, this library could support maps and unordered_maps where the keys are immutable and chosen at compile time, but the values are mutable.

This PR accomplishes this by adding non-const implementations of functions in map and unordered_map.

To avoid code duplication, I made template functions that the const and non-const functions can call to. By doing this, the compiler can generate the const and non-const implementation from one template.

Additional tests, documentation, and examples should be added with this PR, but I was hoping to get some implementation feedback for now.

peter-moran commented 3 years ago

Should "just" need tests now

peter-moran commented 3 years ago

@serge-sans-paille should be good to re-review. I've addressed all your comments and added new tests which should have full coverage of the new non-const methods of map and unordered map.

If that all looks good I'd like to wrap up by adding a section to the readme explaining this feature.

peter-moran commented 3 years ago

@serge-sans-paille should be ready for a final review. I've updated the docs to explain the new functionality.

serge-sans-paille commented 3 years ago

Thanks!