Files
nicole mazzuca d2620cf02b [vcpkg formatting] Turn off DeriveLineEnding (#12368)
* [vcpkg formatting] Turn off DeriveLineEnding

* format

* Add newlines to the end of files

Since we're reformatting anyways
2020-07-14 08:50:19 -07:00

22 lines
438 B
C++

#pragma once
#include <map>
namespace vcpkg
{
template<class Key, class Value>
struct Cache
{
template<class F>
Value const& get_lazy(const Key& k, const F& f) const
{
auto it = m_cache.find(k);
if (it != m_cache.end()) return it->second;
return m_cache.emplace(k, f()).first->second;
}
private:
mutable std::map<Key, Value> m_cache;
};
}