The Pedigree Project  0.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
LazyEvaluate< T, M, create, destroy > Class Template Reference

#include <LazyEvaluate.h>

+ Collaboration diagram for LazyEvaluate< T, M, create, destroy >:

Public Member Functions

 LazyEvaluate (const M &metadata)
 
 LazyEvaluate (M &&metadata)
 
 LazyEvaluate (T *value)
 
 LazyEvaluate (T *value, const M &metadata)
 
 LazyEvaluate (T *value, M &&metadata)
 
bool active () const
 
void reset ()
 
T * get ()
 
T * operator-> ()
 
T & operator* ()
 
 operator bool () const
 
 operator T * ()
 

Private Member Functions

 NOT_COPYABLE_OR_ASSIGNABLE (LazyEvaluate)
 

Private Attributes

m_Metadata
 
T * m_Field
 
bool m_Ok
 

Detailed Description

template<class T, class M, T *(*)(const M &) create, void(*)(T *) destroy>
class LazyEvaluate< T, M, create, destroy >

LazyEvaluate offers a way to defer potentially-expensive evaluation to the time at which the result of the evaluation is needed. This can allow for reduced memory usage and better performance, especially in cases where many objects are available for evaluation but only a few actually become evaluated.

Parameters
[in]Tthe result type of the evaluation
[in]Mtype for metadata to be passed to creation function
[in]createa function that performs evaluation based on the given metadata
[in]destroya function that cleans up an evaluation if needed

Definition at line 40 of file LazyEvaluate.h.


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