From 40e18460bcda85653ee5ff5989b77e1deaa21f1d Mon Sep 17 00:00:00 2001 From: yhirose Date: Fri, 1 May 2026 21:46:13 +0900 Subject: [PATCH] Document str2tag_core's compile-time-only role --- httplib.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/httplib.h b/httplib.h index a2de258f..4bab7bec 100644 --- a/httplib.h +++ b/httplib.h @@ -6361,6 +6361,10 @@ inline void get_remote_ip_and_port(socket_t sock, std::string &ip, int &port) { } } +// Recursive form retained so operator""_t below can compute hashes for +// switch-case labels at compile time (C++11 constexpr forbids loops). Do not +// call from runtime paths with arbitrary-length inputs — use str2tag() +// instead, which is iterative and stack-safe. inline constexpr unsigned int str2tag_core(const char *s, size_t l, unsigned int h) { return (l == 0)