(edward) Build fix for r295416
@@ -162,6 +162,9 @@ void displayErrorForNode(
const MString &message
);
+template <size_t N>
+struct CacheImpl;
+
template<typename Key, typename Value, size_t Size = 50, size_t MaxSize = 0>
class Cache
{
@@ -202,19 +205,28 @@ public:
void insert(Iterator &iter, const Key &key, const Value &value)
{
- Impl<MaxSize>::insert(myCache, iter, key, value);
+ CacheImpl<MaxSize>::insert(myCache, iter, key, value);
}
private:
+ CacheEntries myCache;
+ mutable int myAccessCount;
+
+ template <size_t N> friend struct CacheImpl;
+};
template <size_t N>
- struct Impl
+struct CacheImpl
{
- static void insert(CacheEntries &cache,
+ template <typename CacheEntry,
+ typename Iterator,
+ typename Key,
+ typename Value>
+ void insert(std::vector<CacheEntry> &cache,
Iterator &iter, const Key &key, const Value &value)
{
auto insert_iter = iter;
- if(cache.size() >= MaxSize)
+ if(cache.size() >= N)
{
Iterator min_iter = std::min_element(
cache.begin(), cache.end(),
@@ -231,9 +243,13 @@ private:
};
template<>
- struct Impl<0>
+struct CacheImpl<0>
{
- static void insert(CacheEntries &cache,
+ template <typename CacheEntry,
+ typename Iterator,
+ typename Key,
+ typename Value>
+ static void insert(std::vector<CacheEntry> &cache,
Iterator &iter, const Key &key, const Value &value)
{
auto insert_iter = iter;
@@ -241,11 +257,6 @@ private:
}
};
-private:
- CacheEntries myCache;
- mutable int myAccessCount;
-};
-
class HAPIString
{
public:
