diff --git a/string/rolling_hash_1d.hpp b/string/rolling_hash_1d.hpp index ff2492ca..b2f2127d 100644 --- a/string/rolling_hash_1d.hpp +++ b/string/rolling_hash_1d.hpp @@ -97,6 +97,11 @@ template struct rolling_hash { return length == r.length and val == r.val; } + bool operator<(const Hash &x) const { // To use std::map + if (length != x.length) return length < x.length; + return val < x.val; + } + Hash operator*(const Hash &r) const { return Hash(length + r.length, val * power.at(r.length) + r.val); }