Sauce-0.10.1: sauce::internal::ScopeCache Class Reference

Sauce-0.10.1 A C++ Dependency Injection Framework

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
sauce::internal::ScopeCache Class Reference

## Public Member Functions
template<typename Dependency >
void | put (typename Key< Dependency >::Ptr pointer)
| Insert a dependency into the cache.
template<typename Dependency >
bool | get (typename Key< Dependency >::Ptr &out) const
| Probe the cache for a dependency.

## Member Function Documentation

template<typename Dependency >

bool sauce::internal::ScopeCache::get | ( | typename Key< Dependency >::Ptr & | out | ) | const
| inline

Probe the cache for a dependency.

The return value indicates if a hit was found. On a hit, the out argument will be overwritten with the discovered value.

{
typedef typename Key<Dependency>::Normalized Normalized;
typedef typename Key<Normalized>::Ptr SmartPtr;
Cache::const_iterator cachedPtr = cache.find(typeIdOf<Normalized>());
if (cachedPtr == cache.end()) {
return false;
}
out = *static_cast<SmartPtr *>(cachedPtr->second.get());
return true;
}

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

- sauce/internal/scope_cache.h