Add UpdateCheckSumImpl to TMaybe.
#include <util/generic/array_ref.h>
#include <util/generic/hash.h>
#include <util/generic/map.h>
+#include <util/generic/maybe.h>
#include <util/generic/vector.h>
#include <type_traits>
@@ -56,6 +57,16 @@ namespace NCB {
return UpdateCheckSumImpl(init, TConstArrayRef<T>(vector));
}
+ template <class T>
+ inline ui32 UpdateCheckSumImpl(ui32 init, const TMaybe<T>& value) {
+ const ui8 defined = value.Defined();
+ if (defined) {
+ return UpdateCheckSum(UpdateCheckSum(init, defined), *value);
+ } else {
+ return UpdateCheckSum(init, defined);
+ }
+ }
+
template <class T>
inline ui32 UpdateCheckSum(ui32 init, const T& value) {
if constexpr(std::is_trivial<T>::value) {
