Commit a66062af authored by Mikaël Salson's avatar Mikaël Salson Committed by Mathieu Giraud

algo/core/kmeraffect.h: Provide hash for KmerAffect

This is needed now that we use an unordered_map with a KmerAffect (see
previous commit) as explained here:
https://stackoverflow.com/questions/17016175/c-unordered-map-using-a-custom-class-type-as-the-key
parent 1da82cf3
......@@ -174,6 +174,17 @@ bool operator>=(const KmerAffect &a1, const KmerAffect &a2);
bool operator!=(const KmerAffect &a1, const KmerAffect &a2);
ostream &operator<<(ostream &os, const KmerAffect &kmer);
namespace std {
template <>
struct hash<KmerAffect> {
size_t operator()(const KmerAffect &affect) const {
return (affect.getLabel()[0] << 8) | affect.getLength();
}
};
}
#define AFFECT_NOT_UNKNOWN_SYMBOL "*"
#define AFFECT_AMBIGUOUS_SYMBOL "\0"
#define AFFECT_UNKNOWN_SYMBOL "\1"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment