diff --git a/cpp/src/model.h b/cpp/src/model.h index 4b2450b..12f764e 100644 --- a/cpp/src/model.h +++ b/cpp/src/model.h @@ -169,11 +169,9 @@ inline OptKey optMax(const std::optional& a, const std::optional& b) { inline OptKey topKey() { return std::nullopt; } inline OptKey bottomKey() { return OptKey{Key{}}; } -// A view of a static empty string, so empty views always have a valid pointer. -inline KeyView emptyKeyView() { - static const Key empty; - return KeyView(empty); -} +// A view of the empty string literal, so empty views always have a valid +// pointer. Unlike a function-local static, this needs no guard variable. +inline KeyView emptyKeyView() { return KeyView("", 0); } inline OptKeyView bottomKeyView() { return OptKeyView{emptyKeyView()}; } inline bool isTop(OptKeyView k) { return !k.has_value(); }