diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-11-03 13:43:54 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-11-04 14:31:47 +0000 |
commit | b2cc73a0a85d185ff3697fe568498b91cf24bb78 (patch) | |
tree | e203d02f047412de4398c5ad7f3efca805d2ca10 /vespalib | |
parent | 7afa9dde3c0b86d1b4ded4b4bc583189ba45a17d (diff) |
Simplify and avoid default arguments.
Diffstat (limited to 'vespalib')
3 files changed, 8 insertions, 2 deletions
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store.h b/vespalib/src/vespa/vespalib/datastore/unique_store.h index 71346719932..04bcc3fc10d 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store.h +++ b/vespalib/src/vespa/vespalib/datastore/unique_store.h @@ -51,7 +51,8 @@ private: using generation_t = vespalib::GenerationHandler::generation_t; public: - UniqueStore(std::shared_ptr<alloc::MemoryAllocator> memory_allocator, const std::function<ComparatorType(const DataStoreType&)>& comparator_factory = [](const auto& data_store) { return ComparatorType(data_store);}); + UniqueStore(std::shared_ptr<alloc::MemoryAllocator> memory_allocator, const std::function<ComparatorType(const DataStoreType&)>& comparator_factory); + explicit UniqueStore(std::shared_ptr<alloc::MemoryAllocator> memory_allocator); ~UniqueStore(); void set_dictionary(std::unique_ptr<IUniqueStoreDictionary> dict); UniqueStoreAddResult add(EntryConstRefType value); diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp index a26db11ff31..b2c4d4e8d7e 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp +++ b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp @@ -28,6 +28,11 @@ using DefaultUniqueStoreDictionary = UniqueStoreDictionary<DefaultDictionary>; } template <typename EntryT, typename RefT, typename Comparator, typename Allocator> +UniqueStore<EntryT, RefT, Comparator, Allocator>::UniqueStore(std::shared_ptr<alloc::MemoryAllocator> memory_allocator) + : UniqueStore(std::move(memory_allocator), [](const auto& data_store) { return ComparatorType(data_store);}) +{} + +template <typename EntryT, typename RefT, typename Comparator, typename Allocator> UniqueStore<EntryT, RefT, Comparator, Allocator>::UniqueStore(std::shared_ptr<alloc::MemoryAllocator> memory_allocator, const std::function<ComparatorType(const DataStoreType&)>& comparator_factory) : _allocator(std::move(memory_allocator)), _store(_allocator.get_data_store()), diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.h index d3b3696f042..962084f3a4b 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.h +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.h @@ -31,7 +31,7 @@ private: UniqueStoreBufferType<WrappedEntryType> _typeHandler; public: - UniqueStoreAllocator(std::shared_ptr<alloc::MemoryAllocator> memory_allocator); + explicit UniqueStoreAllocator(std::shared_ptr<alloc::MemoryAllocator> memory_allocator); ~UniqueStoreAllocator() override; EntryRef allocate(const EntryType& value); void hold(EntryRef ref); |