Bitcoin Core 32.1.0
P2P Digital Currency
Loading...
Searching...
No Matches
ByRatioNegSize< T > Class Template Reference

Wrapper around FeeFrac & derived types, which adds a total ordering which first sorts by feerate and then by reversed size (i.e., larger sizes come first). More...

#include <feefrac.h>

Collaboration diagram for ByRatioNegSize< T >:
[legend]

Public Member Functions

constexpr ByRatioNegSize (const T &feefrac) noexcept
 operator const T & () const noexcept

Private Attributes

const T & m_feefrac

Friends

bool operator== (const ByRatioNegSize &a, const ByRatioNegSize &b) noexcept
std::strong_ordering operator<=> (const ByRatioNegSize &a, const ByRatioNegSize &b) noexcept

Detailed Description

template<std::derived_from< FeeFrac > T>
class ByRatioNegSize< T >

Wrapper around FeeFrac & derived types, which adds a total ordering which first sorts by feerate and then by reversed size (i.e., larger sizes come first).

This is not included inside FeeFrac itself, because it is not the most natural behavior, so it is better to make code using it invoke this explicitly.

The empty FeeFrac (fee and size both 0) sorts last. So for example, the following FeeFracs are in sorted order:

  • fee=0 size=1 (feerate 0)
  • fee=1 size=2 (feerate 0.5)
  • fee=2 size=3 (feerate 0.667...)
  • fee=2 size=2 (feerate 1)
  • fee=1 size=1 (feerate 1)
  • fee=3 size=2 (feerate 1.5)
  • fee=2 size=1 (feerate 2)
  • fee=0 size=0 (undefined feerate)

Definition at line 288 of file feefrac.h.

Constructor & Destructor Documentation

◆ ByRatioNegSize()

template<std::derived_from< FeeFrac > T>
ByRatioNegSize< T >::ByRatioNegSize ( const T & feefrac)
inlineconstexprnoexcept

Definition at line 293 of file feefrac.h.

Here is the caller graph for this function:

Member Function Documentation

◆ operator const T &()

template<std::derived_from< FeeFrac > T>
ByRatioNegSize< T >::operator const T & ( ) const
inlinenoexcept

Definition at line 310 of file feefrac.h.

◆ operator<=>

template<std::derived_from< FeeFrac > T>
std::strong_ordering operator<=> ( const ByRatioNegSize< T > & a,
const ByRatioNegSize< T > & b )
friend

Definition at line 300 of file feefrac.h.

◆ operator==

template<std::derived_from< FeeFrac > T>
bool operator== ( const ByRatioNegSize< T > & a,
const ByRatioNegSize< T > & b )
friend

Definition at line 295 of file feefrac.h.

Member Data Documentation

◆ m_feefrac

template<std::derived_from< FeeFrac > T>
const T& ByRatioNegSize< T >::m_feefrac
private

Definition at line 290 of file feefrac.h.


The documentation for this class was generated from the following file: