X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FEvictingCacheMap.h;h=77517f5ac5502677007a03c6a559fba8fb7bad3b;hb=4762a35e70fb08622baed5d30157c99c215f4f15;hp=c32f7821a808517f7ac4104290a767810afc3360;hpb=0318bad6a53a78a0b358fba23a18cc29a7c233e8;p=folly.git diff --git a/folly/EvictingCacheMap.h b/folly/EvictingCacheMap.h index c32f7821..77517f5a 100644 --- a/folly/EvictingCacheMap.h +++ b/folly/EvictingCacheMap.h @@ -1,5 +1,5 @@ /* - * Copyright 2014 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,8 +14,7 @@ * limitations under the License. */ -#ifndef FOLLY_EVICTINGHASHMAP_H_ -#define FOLLY_EVICTINGHASHMAP_H_ +#pragma once #include #include @@ -25,6 +24,7 @@ #include #include #include +#include namespace folly { @@ -90,9 +90,8 @@ namespace folly { * unless evictions of LRU items are triggered by calling prune() by clients * (using their own eviction criteria). */ -template > -class EvictingCacheMap : private boost::noncopyable { - +template > +class EvictingCacheMap { private: // typedefs for brevity struct Node; @@ -148,6 +147,10 @@ class EvictingCacheMap : private boost::noncopyable { maxSize_(maxSize), clearSize_(clearSize) { } + EvictingCacheMap(const EvictingCacheMap&) = delete; + EvictingCacheMap& operator=(const EvictingCacheMap&) = delete; + EvictingCacheMap(EvictingCacheMap&&) = default; + EvictingCacheMap& operator=(EvictingCacheMap&&) = default; ~EvictingCacheMap() { setPruneHook(nullptr); @@ -206,7 +209,7 @@ class EvictingCacheMap : private boost::noncopyable { TValue& get(const TKey& key) { auto it = find(key); if (it == end()) { - throw std::out_of_range("Key does not exist"); + std::__throw_out_of_range("Key does not exist"); } return it->second; } @@ -238,7 +241,7 @@ class EvictingCacheMap : private boost::noncopyable { const TValue& getWithoutPromotion(const TKey& key) const { auto it = findWithoutPromotion(key); if (it == end()) { - throw std::out_of_range("Key does not exist"); + std::__throw_out_of_range("Key does not exist"); } return it->second; } @@ -492,5 +495,3 @@ class EvictingCacheMap : private boost::noncopyable { }; } // folly - -#endif /* FOLLY_EVICTINGHASHMAP_H_ */