userver: concurrent::LazyValue< T > Class Template Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
concurrent::LazyValue< T > Class Template Referencefinal

#include <userver/concurrent/lazy_value.hpp>

Detailed Description

template<typename T>
class concurrent::LazyValue< T >

lazy value computation with multiple users

Definition at line 22 of file lazy_value.hpp.

Public Member Functions

 LazyValue (std::function< T()> f)
 
const T & operator() ()
 Get an already calculated result or calculate it. It is guaranteed that f is called exactly once. Can be called concurrently from multiple coroutines.
 

Constructor & Destructor Documentation

◆ LazyValue()

template<typename T >
concurrent::LazyValue< T >::LazyValue ( std::function< T()> f)
inlineexplicit

Definition at line 24 of file lazy_value.hpp.

Member Function Documentation

◆ operator()()

template<typename T >
const T & concurrent::LazyValue< T >::operator() ( )

Get an already calculated result or calculate it. It is guaranteed that f is called exactly once. Can be called concurrently from multiple coroutines.

Exceptions
anythingf throws.

Definition at line 43 of file lazy_value.hpp.


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