|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Comparator wrapper that inverts the comparison order. More...
#include <tpl_sort_utils.H>
Public Member Functions | |
| Negate_Compare (Compare __cmp=Compare()) noexcept(std::is_nothrow_copy_assignable_v< Compare >) | |
| Construct from a comparator. | |
| bool | operator() (const T &e1, const T &e2) const noexcept(noexcept(std::declval< const Compare & >()(e2, e1))) |
| Compare in reverse order: returns cmp(e2, e1). | |
Private Attributes | |
| Compare | cmp |
Comparator wrapper that inverts the comparison order.
Given a comparator cmp, this wrapper creates a comparator that returns cmp(e2, e1) instead of cmp(e1, e2). This is useful for converting a min-heap algorithm to a max-heap algorithm.
| T | Element type being compared. |
| Compare | The underlying comparator type. |
Definition at line 2948 of file tpl_sort_utils.H.
|
inlinenoexcept |
Construct from a comparator.
Definition at line 2954 of file tpl_sort_utils.H.
|
inlinenoexcept |
Compare in reverse order: returns cmp(e2, e1).
Definition at line 2961 of file tpl_sort_utils.H.
References Aleph::Negate_Compare< T, Compare >::cmp, and Aleph::maps().
|
private |
Definition at line 2950 of file tpl_sort_utils.H.
Referenced by Aleph::Negate_Compare< T, Compare >::operator()().