template<class Type>
class clang::clangd::Key< Type >
Values in a Context are indexed by typed keys.
Key<T> serves two purposes:
- it provides a lookup key for the context (each Key is unique),
- it makes lookup type-safe: a Key<T> can only map to a T (or nothing).
Example: Key<int> RequestID; Key<int> Version;
Context Ctx = Context::empty().derive(RequestID, 10).derive(Version, 3); assert(*Ctx.get(RequestID) == 10); assert(*Ctx.get(Version) == 3);
Keys are typically used across multiple functions, so most of the time you would want to make them static class members or global variables.
Definition at line 41 of file Context.h.