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

Add utility to get values for maps and multi_index containers #4303

Closed

Conversation

gr0vity-dev
Copy link
Contributor

I personally have a hard time know if
if (existing == roots.get<tag_root> ().end ())
means existing is true or false.

I added an utility get_value and get_value_multi_indexto make it more obvious
if (!existing_entry)

I made the changes for one active_transactions class to seee what it would look like and marked the PR as draft.

- Introduced a generic `get_value` function to streamline the process of retrieving values from maps.
- Refactored `active_transactions.cpp` to use the new helper, improving code readability.

# This function simplifies map value retrieval by encapsulating the find-check-return pattern.
- Introduced `get_value_multi_index` in the utility class to facilitate value retrieval from Boost multi-index containers.
- Refactored `active_transactions.cpp` to utilise the new utility function, streamlining code readability.

This change aids in centralising the logic for multi-index value retrieval
@gr0vity-dev gr0vity-dev closed this Oct 9, 2023
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.

1 participant