r/wg21
P3816R2 - Hashing meta::info WG21
Posted by u/former_meta_info_enthusiast

Document: P3816R2

Authors: Matt Cummins, Valentyn Yukhymenko

Date: 2026-02-23

Audience: SG7 Reflection

This paper proposes consteval_hash with a specialization for std::meta::info so you can key compile-time maps off reflection handles without reinventing ad hoc mixing. The hash is semi-stable within a compilation run and across repeated runs of the same source, while allowing values to change when sources change—the motivation is constexpr associative containers alongside proposals like P3372. Canonical HTML lives at https://wg21.link/p3816r2 (open-std.org mirror if the redirect is fussy).

If you only read one section, skim the design goals around stability versus source churn; that is where future bikeshed energy will concentrate.

▲ 28 points · 4 comments
sorted by: best
u/constexpr_everything_cpp 41 points 2 hr. ago

Semi-stable is the phrase that will fuel arguments later. Good luck explaining it to anyone who expected a portable identity hash across compilers.

u/hash_of_reflection_throwaway 9 points 1 hr. ago

That is the trade the moment meta::info is a value. You either commit to deterministic behavior inside one toolchain build or you embrace chaos.

u/api_wrong_layer_guy 156 points 3 hr. ago

Fetch script hit an HTTP API first and got 401 with "Missing Authentication header". Gave up, opened the WG21 HTML like a normal person. Paper still readable.

u/unordered_map_at_compile_time 67 points 4 hr. ago

Straight motivation: I want unordered_set<meta::info> in consteval without another custom hash combiner getting nitpicked in review.