regina::LightweightSequence< T >::SubsequenceCompareFirstPtr< Iterator > Class Template Reference

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 > &cloneMe)
| Creates a clone of the given function object. More...
| ~SubsequenceCompareFirstPtr ()
| Destroys this function 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...
SubsequenceCompareFirstPtr< Iterator > & | operator= (const SubsequenceCompareFirstPtr< Iterator > &cloneMe)
| Makes this function object identical to the given function object. More...

## Detailed Description

### template<typename T>
template<typename Iterator>
class regina::LightweightSequence< T >::SubsequenceCompareFirstPtr< Iterator >

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:

- We are interested in comparing just some, not necessarily all, of the elements of each sequence. The indices of the elements to compare are passed to the constructor of this comparison object.
- The actual objects that we compare are not the sequences themselves, but iterators that point to (key, value) pairs, whose keys are pointers to sequences.

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.

## Constructor & Destructor Documentation

## SubsequenceCompareFirstPtr() [1/2]

template<typename T >
template<typename Iterator >

regina::LightweightSequence< T >::SubsequenceCompareFirstPtr< Iterator >::SubsequenceCompareFirstPtr | ( | size_t | nSub,
|  | const size_t * | sub
| ) |  |

inline

Creates a new function object.

As explained in the class notes, this object compares just some, not necessarily all, elements of two sequences. The indices of the elements to compare should be passed to this constructor.

Parameters

  nSub | the number of elements to compare from each sequence.
  sub | the indices of the elements to compare from each sequence; that is, the indices i0, i1, ..., as described in the class notes.

## SubsequenceCompareFirstPtr() [2/2]

template<typename T >
template<typename Iterator >

regina::LightweightSequence< T >::SubsequenceCompareFirstPtr< Iterator >::SubsequenceCompareFirstPtr | ( | const SubsequenceCompareFirstPtr< Iterator > & | cloneMe | ) |

inline

Creates a clone of the given function object.

Parameters

  cloneMe | the function object to copy.

## ~SubsequenceCompareFirstPtr()

template<typename T >
template<typename Iterator >

regina::LightweightSequence< T >::SubsequenceCompareFirstPtr< Iterator >::~SubsequenceCompareFirstPtr | ( |  | ) |

inline

Destroys this function object.

## Member Function Documentation

## equal()

template<typename T >
template<typename Iterator >

bool regina::LightweightSequence< T >::SubsequenceCompareFirstPtr< Iterator >::equal | ( | Iterator | a,
|  | Iterator | b
| ) |  | const

inline

Tests whether the subsequences referred to by the given pair of iterators are identical.

See the class notes for details on how each iterator is converted into a subsequence.

Parameters

  a | an iterator indicating the first of the two subsequences to compare.
  b | an iterator indicating the second of the two subsequences to compare.

Returns
  `true` if and only if the two subsequences are identical.

## less()

template<typename T >
template<typename Iterator >

bool regina::LightweightSequence< T >::SubsequenceCompareFirstPtr< Iterator >::less | ( | Iterator | a,
|  | Iterator | b
| ) |  | const

inline

Lexicographically compares the subsequences referred to by the given pair of iterators.

See the class notes for details on how each iterator is converted into a subsequence.

This member function is identical to the bracket operator.

Parameters

  a | an iterator indicating the first of the two subsequences to compare.
  b | an iterator indicating the second of the two subsequences to compare.

Returns
  `true` if and only if the subsequence indicated by a is lexicographically smaller than the subsequence indicated by b.

## operator()()

template<typename T >
template<typename Iterator >

bool regina::LightweightSequence< T >::SubsequenceCompareFirstPtr< Iterator >::operator() | ( | Iterator | a,
|  | Iterator | b
| ) |  | const

inline

Lexicographically compares the subsequences referred to by the given pair of iterators.

See the class notes for details on how each iterator is converted into a subsequence.

This bracket operator is identical to the less() member function.

Parameters

  a | an iterator indicating the first of the two subsequences to compare.
  b | an iterator indicating the second of the two subsequences to compare.

Returns
  `true` if and only if the subsequence indicated by a is lexicographically smaller than the subsequence indicated by b.

## operator=()

template<typename T >
template<typename Iterator >

LightweightSequence< T >::SubsequenceCompareFirstPtr< Iterator > & regina::LightweightSequence< T >::SubsequenceCompareFirstPtr< Iterator >::operator= | ( | const SubsequenceCompareFirstPtr< Iterator > & | cloneMe | ) |

inline

Makes this function object identical to the given function object.

The original list of indices that was previously stored with this function object will be destroyed.

Parameters

  cloneMe | the function object to copy.

Returns
  a reference to this function object.

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

- utilities/sequence.h

Copyright © 1999-2016, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).