여러 저장된 클래스에 대한 일반 캐시가 필요한 프로젝트에서 작업 중입니다. 내 기본 클래스는 다음과 같습니다Variadic 템플릿 클래스 - 가변 멤버 함수
template<typename ... Types>
class VarCache{
template<typename T>
using item_type = shared_ptr<holder<T>>;
template<typename T>
using map_type = map<int64_t,item_type <T>>;
public:
std::tuple<map_type<Types>...> caches;
};
내가 인수를 허용하지 않을 것이다 함수를 작성해야하지만 캐시 개체에 호출함으로써, 반복적으로 저장된 모든지도의 변종을 통과, 행동 (불필요한 항목을 제거하는) perfrom 것 .
예 :
I VarCache<A,B,C> cache
및 T
이 cache.prune_all_variants();
를 호출하여
및 A,B,C
중 하나입니다 방법 prune<T>();
내가 캐시
prune<A>();
prune<B>();
prune<C>();
수행 할이 수 있나요?
고맙습니다. 큰 :). – semtexzv