Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
EqualSortedMethod< Container > Class Template Reference

Equality test for containers sorted by a comparator. More...

#include <ah-dry.H>

Inherited by Aleph::DynIntervalTree< int >, Aleph::DynSetTree< GT::Arc *, Treap, Dft_Arc_Cmp< GT > >, Aleph::DynSetTree< std::pair< Key, Type >, Avl_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, BinTree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Rand_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Rb_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Splay_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Treap, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Treap_Rk, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Data >, Avl_Tree, Dft_Pair_Cmp< Key, Data, Aleph::less< Key > > >, Aleph::DynSetTree< Key, Avl_Tree_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Key, Avl_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, BinTree, Aleph::less< Key > >, Aleph::DynSetTree< Key, HtdRbTreeRk, Aleph::less< Key > >, Aleph::DynSetTree< Key, HtdRbTree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Rand_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Rb_Tree_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Key, Rb_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Splay_Tree_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Key, Splay_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, TdRbTreeRk, Aleph::less< Key > >, Aleph::DynSetTree< Key, TdRbTree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Treap, Aleph::less< Key > >, Aleph::DynSetTree< Key, Treap_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Node * >, Aleph::DynSetTree< GT::Node *, Treap, Dft_Node_Cmp< GT > >, Aleph::DynSetTree< std::pair< Key, Operation >, Avl_Tree, Dft_Pair_Cmp< Key, Operation, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, ValueType >, Avl_Tree, Dft_Pair_Cmp< Key, ValueType, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< void *, Flow_Type >, Avl_Tree, Dft_Pair_Cmp< void *, Flow_Type, Aleph::less< void * > > >, Aleph::DynSetTree< std::pair< const Aleph::Compiler_Expr *, size_t >, Avl_Tree, Dft_Pair_Cmp< const Aleph::Compiler_Expr *, size_t, Aleph::less< const Aleph::Compiler_Expr * > > >, Aleph::DynSetTree< std::pair< Aleph::Array< size_t >, double >, Aleph::Avl_Tree, Dft_Pair_Cmp< Aleph::Array< size_t >, double, Grevlex_Order > >, Aleph::DynSetTree< std::pair< size_t, double >, Avl_Tree, Dft_Pair_Cmp< size_t, double, Aleph::less< size_t > > >, Aleph::DynSetTree< std::pair< Node *, Node * >, Treap, Dft_Pair_Cmp< Node *, Node *, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< std::string, Huffman_Node * >, Treap_Vtl, Dft_Pair_Cmp< std::string, Huffman_Node *, Aleph::less< std::string > > >, Aleph::DynSetTree< std::pair< std::string, BitArray >, Treap_Vtl, Dft_Pair_Cmp< std::string, BitArray, Aleph::less< std::string > > >, Aleph::DynSetTree< GT_Arc *, Rand_Tree, Aleph::IndexArc::Cmp_Arc >, Aleph::DynSetTree< GT_Node *, Treap, Dft_Node_Cmp< GT > >, Aleph::DynSetTree< GT_Arc *, Treap, Aleph::IndexArc::Cmp_Arc >, Aleph::DynSetTree< std::pair< int, int >, Avl_Tree, Aleph::less< std::pair< int, int > > >, Aleph::DynSetTree< std::pair< Node *, size_t >, Avl_Tree, Dft_Pair_Cmp< Node *, size_t, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< Node *, Node * >, Avl_Tree, Dft_Pair_Cmp< Node *, Node *, Aleph::less< Node * > > >, Aleph::DynSetTree< Aleph::LineSweepFramework::SeqEvent, Aleph::Avl_Tree, Aleph::LineSweepFramework::CmpSeqEvent >, Aleph::DynSetTree< Node *, Rand_Tree >, Aleph::DynSetTree< Arc *, Rand_Tree >, Aleph::DynSetTree< std::pair< Arc *, size_t >, Avl_Tree, Dft_Pair_Cmp< Arc *, size_t, Aleph::less< Arc * > > >, Aleph::DynSetTree< Aleph::VisibilityPolygon::EdgeStatusTree::EdgeKey, Aleph::Treap, Aleph::VisibilityPolygon::EdgeStatusTree::EdgeKeyCmp >, Aleph::DynSetTree< std::pair< Pair_Key, Arc * >, Avl_Tree, Dft_Pair_Cmp< Pair_Key, Arc *, Aleph::less< Pair_Key > > >, Aleph::DynSetTree< std::pair< Node *, Aleph::Tree_Node * >, Avl_Tree, Dft_Pair_Cmp< Node *, Aleph::Tree_Node *, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< Node *, Aleph::DynSetTree< Node * > >, Avl_Tree, Dft_Pair_Cmp< Node *, Aleph::DynSetTree< Node * >, Aleph::less< Node * > > >, Aleph::DynSetTree< Arc * >, Aleph::DynSetTree< std::pair< Arc *, Arc * >, Avl_Tree, Dft_Pair_Cmp< Arc *, Arc *, Aleph::less< Arc * > > >, Aleph::DynSetTree< std::pair< Node *, Cost_Type >, Avl_Tree, Dft_Pair_Cmp< Node *, Cost_Type, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< Node *, Arc * >, Avl_Tree, Dft_Pair_Cmp< Node *, Arc *, Aleph::less< Node * > > >, Aleph::DynSetTree< int >, Aleph::DynSetTree< GT_Node *, Treap, TestNodeCmp >, Aleph::DynSetTree< Relation_T::Pair, Avl_Tree, Relation_T::Cmp >, Aleph::DynSetTree< std::pair< Event::EventId, TimeoutQueue::Event * >, Avl_Tree, Dft_Pair_Cmp< Event::EventId, TimeoutQueue::Event *, Aleph::less< Event::EventId > > >, Aleph::DynSetTree< TimeoutQueue::Event * >, Aleph::DynSetTree< size_t >, Aleph::DynIntervalTree< T, Compare >, and Aleph::DynSetTree< Key, Tree, Compare >.

Public Member Functions

bool equal_to (const Container &r) const
 Equality test between this and r.
 

Private Member Functions

const Container * const_me () const noexcept
 

Friends

bool operator== (const Container &l, const Container &r)
 Equality operator.
 
bool operator!= (const Container &l, const Container &r)
 Inequality operator.
 

Detailed Description

template<class Container>
class EqualSortedMethod< Container >

Equality test for containers sorted by a comparator.

The two containers are traversed in order at the same time, and two elements are equal if neither precedes the other according to the comparator returned by key_comp(). It is O(n), and it counts the repetitions, so it is right for sorted containers that may keep repeated keys, as DynSetTree with insert_dup().

Template Parameters
Containercontainer type; it must provide size(), key_comp() and an iterator that visits the elements in order.

Definition at line 3114 of file ah-dry.H.

Member Function Documentation

◆ const_me()

template<class Container >
const Container * EqualSortedMethod< Container >::const_me ( ) const
inlineprivatenoexcept

Definition at line 3116 of file ah-dry.H.

Referenced by EqualSortedMethod< Container >::equal_to().

◆ equal_to()

template<class Container >
bool EqualSortedMethod< Container >::equal_to ( const Container &  r) const
inline

Equality test between this and r.

Parameters
[in]rcontainer to compare with.
Returns
true if both containers have the same size and their elements are equivalent one by one in sorted order.
Exceptions
anythingthat the comparator or the iterators throw.

Definition at line 3129 of file ah-dry.H.

References Aleph::dry_detail::advance(), cmp(), EqualSortedMethod< Container >::const_me(), Aleph::dry_detail::current(), Aleph::Const_Iterator< It >::has_curr(), and r.

Referenced by test_DynSet().

Friends And Related Symbol Documentation

◆ operator!=

template<class Container >
bool operator!= ( const Container &  l,
const Container &  r 
)
friend

Inequality operator.

Negation of equal_to(r).

Parameters
[in]lContainer to compare.
[in]rContainer to compare with.
Returns
Negation of l.equal_to(r).
Exceptions
Propagatessame exceptions as equal_to().

Definition at line 3176 of file ah-dry.H.

◆ operator==

template<class Container >
bool operator== ( const Container &  l,
const Container &  r 
)
friend

Equality operator.

Forwards to equal_to(r).

A hidden friend with two parameters of the same type: the C++20 reversed candidate converts its arguments in the same way, so it is never ambiguous. As a member of this base class it was, and Clang 14 rejected a == b in constraints.

Parameters
[in]lContainer to compare.
[in]rContainer to compare with.
Returns
Result of l.equal_to(r).
Exceptions
Propagatessame exceptions as equal_to().

Definition at line 3165 of file ah-dry.H.


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