CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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

Definition at line 30 of file LazyConstructed.h.

30 : args_(args...) {}
std::tuple< Args const &...> args_

Member Function Documentation

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

Definition at line 40 of file LazyConstructed.h.

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

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

40 { evaluateImpl(std::make_index_sequence<sizeof...(Args)>{}); }
void evaluateImpl(std::index_sequence< ArgIndices...>)
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.

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

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

43  {
44  object_ = WrappedClass(std::get<ArgIndices>(args_)...);
45  }
std::tuple< Args const &...> args_
std::optional< WrappedClass > object_
template<class WrappedClass , class... Args>
WrappedClass& LazyConstructed< WrappedClass, Args >::value ( )
inline

Member Data Documentation

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