clang-tools 8.0.0

Public Member Functions | List of all members
clang::clangd::Key< Type > Class Template Reference

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

`#include <Context.h>`

## Public Member Functions
constexpr | Key ()=default
| Key (Key const &)=delete
Key & | operator= (Key const &)=delete
| Key (Key &&)=delete
Key & | operator= (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 41 of file Context.h.

## Constructor & Destructor Documentation

## ◆ Key() [1/3]

template<class Type>

constexpr clang::clangd::Key< Type >::Key | ( |  | ) |
| default

Referenced by clang::clangd::Context::getExisting().

## ◆ Key() [2/3]

template<class Type>

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

## ◆ Key() [3/3]

template<class Type>

clang::clangd::Key< Type >::Key | ( | Key< Type > && |  | ) |
| delete

## Member Function Documentation

## ◆ operator=() [1/2]

template<class Type>

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

Referenced by clang::clangd::WithContext::~WithContext().

## ◆ operator=() [2/2]

template<class Type>

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

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

- Context.h