[#ByRatioNegSize]
= ByRatioNegSize
:mrdocs:

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

== Synopsis

Declared in `&lt;util&sol;feefrac&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;std::derived&lowbar;from&lt;FeeFrac&gt; T&gt;
class ByRatioNegSize;
----

== Description

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&period;

The empty FeeFrac (fee and size both 0) sorts last&period; So for example, the following FeeFracs are in sorted order&colon;

* fee&equals;0 size&equals;1 (feerate 0)
* fee&equals;1 size&equals;2 (feerate 0&period;5)
* fee&equals;2 size&equals;3 (feerate 0&period;667&period;&period;&period;)
* fee&equals;2 size&equals;2 (feerate 1)
* fee&equals;1 size&equals;1 (feerate 1)
* fee&equals;3 size&equals;2 (feerate 1&period;5)
* fee&equals;2 size&equals;1 (feerate 2)
* fee&equals;0 size&equals;0 (undefined feerate)

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:ByRatioNegSize/2constructor.adoc[`ByRatioNegSize`]         [.small]#[constructor]#
| Wrap a FeeFrac (or derived type) for feerate&hyphen;then&hyphen;reversed&hyphen;size comparison&period;
| xref:ByRatioNegSize/2conversion.adoc[`operator T const&`] 
| Convert back to the underlying FeeFrac, which allows using std&colon;&colon;max()&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:operator_3way-03.adoc[operator&lt;&equals;&gt;]`
| Order two wrapped FeeFracs by feerate, then by reversed size&period;
| `xref:operator_eq-039.adoc[operator&equals;&equals;]`
| Check whether two wrapped FeeFracs are equal (same fee and same size)&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
