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-03 13:43:54 +0000 |
commit | 518744fc78a512f597959959db1fbe08ad828098 (patch) | |
tree | 6085cb3aa79996f5fc483777a727e9dafe0c25dd /vespalib | |
parent | f3b6e0c757d8813a1b4e5c78a4fa7ab3bdef9606 (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); |