20 #if !defined(__MITSUBA_CORE_CACHE_H_)
21 #define __MITSUBA_CORE_CACHE_H_
71 template <
typename ArgType,
typename ReturnType>
class SimpleCache
83 template <
typename UpdateFunctor>
inline ReturnType &
get(
const UpdateFunctor &functor,
const ArgType &argument) {
87 if (EXPECT_NOT_TAKEN(!existed || value->first != argument)) {
88 value->first = argument;
89 functor(value->first, value->second);
ValueType & get()
Return a reference to the data associated with the current thread.
Definition: tls.h:127
std::pair< ArgType, ReturnType > ValueType
Definition: simplecache.h:74
SimpleCache()
Definition: simplecache.h:77
PrimitiveThreadLocal< ValueType > ParentType
Definition: simplecache.h:75
Thin wrapper around posix thread local storage. Stores heap-allocated data other than Object instance...
Definition: tls.h:115
Generic thread-local storage for caching evaluations of expensive function calls. ...
Definition: simplecache.h:71