P3816R2 — Hashing meta::info
(7 items)
SG7 Reflection
This paper proposes a new standard library template consteval_hash, with an initial specialization for meta::info, to provide a standard interface for compile-time hashing. The primary motivation is to enable unordered associative containers such as unordered_map and unordered_set to be used with meta::info keys in constexpr contexts, complementing the constexpr containers proposed in P3372. The proposed hash has semi-stable semantics, remaining consistent within a compilation run and across repeated runs of the same source code, while permitting values to change when source code is modified.
- Section 7.3 (Feature testing macros), code block cb14 — Feature-test macro names use prefix __lib_ but all standard library feature-test macros in [version.syn] use the prefix __cpp_lib_; should be __cpp_lib_consteval_hash_template and __cpp_lib_consteval_hash_meta_info. [1]
-
Section 7.1, proposed [unord.consteval_hash] paragraph 3 — Toolchain rendering artifact: the text "> {.cpp}" appears in the proposed wording, where ">" is a remnant of an unrendered
template parameter and "{.cpp}" is a leaked pandoc language annotation; should read "consteval_hash " matching [unord.hash] paragraph 3. [2] - Section 4.2, code block cb3 (line 1) — Trailing return type declaration is missing the placeholder type auto before the function name; should be consteval auto name_of(meta::info r) -> string_view. [3]
- Section 4.2, code block cb4 (line 1) — Same missing auto placeholder type as cb3; should be consteval auto name_of(meta::info r) -> string_view. [4]
- Section 6.1.1 (Unstable hash), third bullet (Con) — "reproducability" is misspelled; should be "reproducibility". [1] [5]
- Section 9.1 (More predefined specializations) — Incorrect indefinite article "an problem"; should be "a problem". [6]
References — Anthropic Citations API
[1]
"consteval name_of(meta::info r) -> string_view"
"consteval name_of(meta::info r) -> string_view"
[2]
"consteval name_of(meta::info r) -> string_view"
"consteval name_of(meta::info r) -> string_view"
[3]
chars 61217–62248
"Further, hashing the same object multiple times (within a translation unit) will return the same value each time for any given compiler run.
"Further, hashing the same object multiple times (within a translation unit) will return the same value each time for any given compiler run.
Something that requires more discussion is the..."
[4]
"#define __lib_consteval_hash_template YYYYXXL // also in and #define __lib_consteval_hash_meta_info YYYYXXL // also in "
"#define __lib_consteval_hash_template YYYYXXL // also in and #define __lib_consteval_hash_meta_info YYYYXXL // also in "
[5]
"Disabled specializations of `consteval_hash`> {.cpp} are not function object types ([function.objects])."
"Disabled specializations of `consteval_hash`> {.cpp} are not function object types ([function.objects])."
[6]
"By separating compile-time hashing into a distinct type, this inconsistency is no longer an problem."
"By separating compile-time hashing into a distinct type, this inconsistency is no longer an problem."
Summary: P3816R2 proposes adding a consteval_hash class template and a specialization for std::meta::info to enable compile-time hashing of reflection values, primarily to support consteval-time associative containers. It also proposes consteval_hash specializations for standard scalar and string-like types.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.