/* * Copyright 2014 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FRUIT_HASH_HELPERS_DEFN_H #define FRUIT_HASH_HELPERS_DEFN_H #include #include namespace fruit { namespace impl { template inline HashSet createHashSet() { return createHashSet(10); } template inline HashSet createHashSet(size_t capacity) { return HashSet(capacity, std::hash()); } template inline HashSetWithArenaAllocator createHashSetWithArenaAllocator(size_t capacity, MemoryPool& memory_pool) { return HashSetWithArenaAllocator(capacity, std::hash(), std::equal_to(), ArenaAllocator(memory_pool)); } template inline HashSetWithArenaAllocator createHashSetWithArenaAllocatorAndCustomFunctors(size_t capacity, MemoryPool& memory_pool, Hasher hasher, EqualityComparator equality_comparator) { return HashSetWithArenaAllocator(capacity, hasher, equality_comparator, ArenaAllocator(memory_pool)); } template inline HashMap createHashMap() { return createHashMap(10); } template inline HashMap createHashMap(size_t capacity) { return HashMap(capacity, std::hash()); } template inline HashMapWithArenaAllocator createHashMapWithArenaAllocator(std::size_t capacity, MemoryPool& memory_pool) { return createHashMapWithArenaAllocatorAndCustomFunctors(capacity, memory_pool, std::hash(), std::equal_to()); } template inline HashMapWithArenaAllocator createHashMapWithArenaAllocatorAndCustomFunctors(size_t capacity, MemoryPool& memory_pool, Hasher hasher, EqualityComparator equality_comparator) { return HashMapWithArenaAllocator( capacity, hasher, equality_comparator, ArenaAllocator>(memory_pool)); } } // namespace impl } // namespace fruit #endif // FRUIT_HASH_HELPERS_DEFN_H