Files
rippled/include/xrpl/basics
Ed Hennis 5abecb9fcb Significant rewrite
- Simplify Number::operator/= to use more constexpr values, and fewer
  variations.
  - Most significantly, rounding up doesn't need more precision, it only
    needs to know if there's a remainder after the current precision work
    is done. Tracked similarly Guard::xbit_.
- Build a constexpr lookup array for powers of 10. Only a handful of
  values are used, but since it's built at compile time, and constexpr,
  unused values do not affect memory or performance.
2026-05-27 00:07:48 -04:00
..
2026-05-27 00:07:48 -04:00

Basics

Utility functions and classes.

The module xrpl/basics should contain no dependencies on other modules.

Choosing an xrpld container.

  • std::vector

    • For ordered containers with most insertions or erases at the end.
  • std::deque

    • For ordered containers with most insertions or erases at the start or end.
  • std::list

    • For ordered containers with inserts and erases to the middle.
    • For containers with iterators stable over insert and erase.
    • Generally slower and bigger than std::vector or std::deque except for those cases.
  • std::set

    • For sorted containers.
  • xrpl::hash_set

    • Where inserts and contains need to be O(1).
    • For "small" sets, std::set might be faster and smaller.
  • xrpl::hardened_hash_set

The following container is deprecated

  • std::unordered_set
  • Use xrpl::hash_set instead, which uses a better hashing algorithm.
  • Or use xrpl::hardened_hash_set to prevent algorithmic complexity attacks.