Class
Lexical
Comparator for lexical comparison.
Include Headers
seqan/sequence.h
Parameters
The specializing type. This type can be used for specializations of Metafunctions: Spec Default: Remarks: |
Remarks
This class implement comparator objects that perform (lexical) comparisons between two sequences.
The result of the comparison is stored in the data members of the instance and can be
accessed by some functions, for example isLess or isEqual.
In most cases, there is no need for an explicite use of comparators,
but sometimes this concept provide the opportunity to speed up the code.
Functions
Compares two objects. | |
Test whether a sequence is prefix of another sequence. | |
Operator "==". | |
Operator ">". | |
Operator ">=". | |
Operator "<". | |
Operator "<=". | |
Operator "!=". | |
Test whether a sequence is prefix of another sequence. | |
Length of longest common prefix. |
Examples
This program compares the strings str1 and str2 :
{
//str1 < str2
}
else if (isGreater(str1, str2)) //second comparison
{
//str1 > str2
}
else
{
//str == str2
}
Using a comparator, the same program only needs one comparison instead of two:
if (isLess(comparator))
{
//str1 < str2
}
else if (lexGreater(comparator))
{
//str1 > str2
}
else
{
//str == str2
}
The state of a default constructed Lexical instance is undefined until
it is set by a call of compare.
See Also
SeqAn - Sequence Analysis Library - www.seqan.de