map-like heterogeneous data storage
More...
#include <userver/utils/any_storage.hpp>
|
template<typename Data > |
const Data & | Get (const AnyStorageDataTag< StorageTag, Data > &tag) const |
|
template<typename Data > |
Data & | Get (const AnyStorageDataTag< StorageTag, Data > &tag) |
|
template<typename Data > |
Data & | Set (AnyStorageDataTag< StorageTag, Data > tag, Data data) |
| Stores the data.
|
|
template<typename Data , typename... Args> |
Data & | Emplace (const AnyStorageDataTag< StorageTag, Data > &tag, Args &&... args) |
| Emplaces the data. The data is rewritten if already stored.
|
|
template<typename Data > |
Data * | GetOptional (const AnyStorageDataTag< StorageTag, Data > &tag) noexcept |
|
template<typename Data > |
const Data * | GetOptional (const AnyStorageDataTag< StorageTag, Data > &tag) const noexcept |
|
template<typename Data > |
void | Erase (const AnyStorageDataTag< StorageTag, Data > &tag) |
| Erase data.
|
|
map-like heterogeneous data storage
Usage example
Definition at line 79 of file any_storage.hpp.
◆ AnyStorage()
◆ ~AnyStorage()
◆ Emplace()
template<
typename Data , typename... Args>
Emplaces the data. The data is rewritten if already stored.
Definition at line 165 of file any_storage.hpp.
◆ Get() [1/2]
- Returns
- Stored data.
- Exceptions
-
std::runtime_error | if no data was stored |
Definition at line 179 of file any_storage.hpp.
◆ Get() [2/2]
◆ GetOptional() [1/2]
- Returns
- Pointer to stored data or nullptr if no data found.
Definition at line 206 of file any_storage.hpp.
◆ GetOptional() [2/2]
- Returns
- Pointer to stored data or nullptr if no data is found.
Definition at line 196 of file any_storage.hpp.
◆ Set()
The documentation for this class was generated from the following file: