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

Use spaceship comparisons #4767

Merged
merged 9 commits into from
Oct 25, 2024

Conversation

pwojcikdev
Copy link
Contributor

The reason for starting this work was that nano::account didn't provide an ordering operators, but this reworks several aspects of other nano primitive types like nano::block_hash, nano::hash_or_account etc:

  • Implements strong ordering of values for all types with the use of C++ <=> spaceship operator. Previously some types could not be ordered, like the mentioned nano::account
  • Remove the use of reinterpret_cast 😬
  • Keep definitions of commonly used functions inline in the header to hopefully enable more aggressive compiler optimizations
  • Ensure that all types provide hashing adapters, for both std::hash and boost::hash

@pwojcikdev pwojcikdev force-pushed the spaceship-comparisons branch from 4f48f12 to 5d341f4 Compare October 25, 2024 18:32
Copy link
Contributor

@clemahieu clemahieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good cleanup.

@gr0vity-dev-bot
Copy link

Test Results for Commit 5d341f4

Pull Request 4767: Results
Overall Status:

Test Case Results

  • 5n4pr_conf_10k_bintree: PASS (Duration: 114s)
  • 5n4pr_conf_10k_change: PASS (Duration: 208s)
  • 5n4pr_conf_change_dependant: PASS (Duration: 153s)
  • 5n4pr_conf_change_independant: PASS (Duration: 148s)
  • 5n4pr_conf_send_dependant: PASS (Duration: 135s)
  • 5n4pr_conf_send_independant: PASS (Duration: 137s)
  • 5n4pr_rocks_10k_bintree: PASS (Duration: 115s)
  • 5n4pr_rocks_10k_change: PASS (Duration: 226s)

Last updated: 2024-10-25 19:21:07 UTC

@pwojcikdev pwojcikdev merged commit 04ebc91 into nanocurrency:develop Oct 25, 2024
27 of 28 checks passed
@qwahzi qwahzi added this to the V28 milestone Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Merged / V28.0
Development

Successfully merging this pull request may close these issues.

4 participants