CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
LazyConstructed< WrappedClass, Args > Class Template Reference

#include "CommonTools/Utils/interface/LazyConstructed.h"

Public Member Functions

 LazyConstructed (Args const &... args)
 
WrappedClass & value ()
 

Private Member Functions

void evaluate ()
 
template<std::size_t... ArgIndices>
void evaluateImpl (std::index_sequence< ArgIndices... >)
 

Private Attributes

std::tuple< Args const &... > args_
 
std::optional< WrappedClass > object_ = std::nullopt
 

Detailed Description

template<class WrappedClass, class... Args>
class LazyConstructed< WrappedClass, Args >

Description: Wrapper around a class for lazy construction.

Usage: example: lazy SoA table auto object = makeLazy<edm::soa::EtaPhiTable>(trackCollection);

Notes: See similar class CommonTools/Utils/interface/LazyResult.h for implementation details.

Definition at line 28 of file LazyConstructed.h.

Constructor & Destructor Documentation

◆ LazyConstructed()

template<class WrappedClass , class... Args>
LazyConstructed< WrappedClass, Args >::LazyConstructed ( Args const &...  args)
inline

Definition at line 30 of file LazyConstructed.h.

30 : args_(args...) {}

Member Function Documentation

◆ evaluate()

template<class WrappedClass , class... Args>
void LazyConstructed< WrappedClass, Args >::evaluate ( )
inlineprivate

Definition at line 40 of file LazyConstructed.h.

40 { evaluateImpl(std::make_index_sequence<sizeof...(Args)>{}); }

References LazyConstructed< WrappedClass, Args >::evaluateImpl().

Referenced by LazyConstructed< WrappedClass, Args >::value().

◆ evaluateImpl()

template<class WrappedClass , class... Args>
template<std::size_t... ArgIndices>
void LazyConstructed< WrappedClass, Args >::evaluateImpl ( std::index_sequence< ArgIndices... >  )
inlineprivate

Definition at line 43 of file LazyConstructed.h.

43  {
44  object_ = WrappedClass(std::get<ArgIndices>(args_)...);
45  }

References LazyConstructed< WrappedClass, Args >::args_, and LazyConstructed< WrappedClass, Args >::object_.

Referenced by LazyConstructed< WrappedClass, Args >::evaluate().

◆ value()

template<class WrappedClass , class... Args>
WrappedClass& LazyConstructed< WrappedClass, Args >::value ( )
inline

Member Data Documentation

◆ args_

template<class WrappedClass , class... Args>
std::tuple<Args const&...> LazyConstructed< WrappedClass, Args >::args_
private

◆ object_

template<class WrappedClass , class... Args>
std::optional<WrappedClass> LazyConstructed< WrappedClass, Args >::object_ = std::nullopt
private
writedatasetfile.args
args
Definition: writedatasetfile.py:18
LazyConstructed::args_
std::tuple< Args const &... > args_
Definition: LazyConstructed.h:48
LazyConstructed::evaluate
void evaluate()
Definition: LazyConstructed.h:40
LazyConstructed::evaluateImpl
void evaluateImpl(std::index_sequence< ArgIndices... >)
Definition: LazyConstructed.h:43
LazyConstructed::object_
std::optional< WrappedClass > object_
Definition: LazyConstructed.h:47