From dfa61978c3f4d8ad3ddd71c57b406e83076a8473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Stojko?= Date: Tue, 1 Dec 2026 11:55:26 +0000 Subject: [PATCH] docs: frequent items: the item move or copy constructor must not throw The map copies or moves items on add, growth and purge. If a constructor throws, the sketch is inconsistent and must not be used. Co-authored-by: Isaac --- fi/include/frequent_items_sketch.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fi/include/frequent_items_sketch.hpp b/fi/include/frequent_items_sketch.hpp index 2dd337e5e..fe5feefe1 100644 --- a/fi/include/frequent_items_sketch.hpp +++ b/fi/include/frequent_items_sketch.hpp @@ -49,6 +49,11 @@ enum frequent_items_error_type { * For sketches containing strings, cross-language portability depends on * using compatible string encodings. This class does not by itself enforce * UTF-8 validity for all string inputs. + * + * The map copies or moves items when an item is added, when it grows, and when it purges. + * So the move constructor of T must not throw, and neither must the copy constructor, + * which takes the move's place if T has no move constructor. + * If one throws, do not use the sketch, and destroying it may be undefined behavior. */ template< typename T,