clang-tools 22.0.0git
clang::clangd::Key< Type > Class Template Reference

Values in a Context are indexed by typed keys. More...

#include <Context.h>

Inheritance diagram for clang::clangd::Key< Type >:
[legend]

Public Member Functions

constexpr Key ()=default
 Key (Key const &)=delete
Keyoperator= (Key const &)=delete
 Key (Key &&)=delete
Keyoperator= (Key &&)=delete

Detailed Description

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 40 of file Context.h.

Constructor & Destructor Documentation

◆ Key() [1/3]

template<class Type>
clang::clangd::Key< Type >::Key ( )
constexprdefault

Referenced by Key(), Key(), operator=(), and operator=().

◆ Key() [2/3]

template<class Type>
clang::clangd::Key< Type >::Key ( Key< Type > const & )
delete

References Key().

◆ Key() [3/3]

template<class Type>
clang::clangd::Key< Type >::Key ( Key< Type > && )
delete

References Key().

Member Function Documentation

◆ operator=() [1/2]

template<class Type>
Key & clang::clangd::Key< Type >::operator= ( Key< Type > && )
delete

References Key().

◆ operator=() [2/2]

template<class Type>
Key & clang::clangd::Key< Type >::operator= ( Key< Type > const & )
delete

References Key().


The documentation for this class was generated from the following file: