Regina Calculation Engine
|
A binary function object for comparing subsequences, for use in associative containers whose keys are pointers to sequences. More...
#include <utilities/sequence.h>
Public Member Functions | |
SubsequenceCompareFirstPtr (size_t nSub, const size_t *sub) | |
Creates a new function object. More... | |
SubsequenceCompareFirstPtr (const SubsequenceCompareFirstPtr< Iterator > &)=default | |
Copies the given function object into this new object. More... | |
SubsequenceCompareFirstPtr< Iterator > & | operator= (const SubsequenceCompareFirstPtr< Iterator > &)=default |
Copies the given function object into this object. More... | |
bool | equal (Iterator a, Iterator b) const |
Tests whether the subsequences referred to by the given pair of iterators are identical. More... | |
bool | less (Iterator a, Iterator b) const |
Lexicographically compares the subsequences referred to by the given pair of iterators. More... | |
bool | operator() (Iterator a, Iterator b) const |
Lexicographically compares the subsequences referred to by the given pair of iterators. More... | |
A binary function object for comparing subsequences, for use in associative containers whose keys are pointers to sequences.
This is a very specialised comparison object, for use in the following settings:
More precisely: suppose the indices of the elements to compare are i0, i1, i2, ..., and that we are comparing iterators a, b. Then this function object will consider the sequences s = *(a->first)
and t = *(b->first)
, and will lexicographically compare their subsequences s[i0], s[i1], ...
and t[i0], t[i1], ...
.
Note that the indices i0, i1, ... do not need to be in increasing order.
This class is meant to be lightweight: it merely stores a reference to the list of elements to compare, and it is safe and fast to pass around by value. The cost of this is that the caller must ensure that the list of elements to compare (which is a C-style array) has a lifespan at least as long as this object. This behaviour is new as of Regina 5.3; in past versions of Regina the list of elements was copied on construction.