diff options
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/shared_string_repo/shared_string_repo_test.cpp | 6 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/shared_string_repo.h | 4 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/string_id.h | 5 |
3 files changed, 9 insertions, 6 deletions
diff --git a/vespalib/src/tests/shared_string_repo/shared_string_repo_test.cpp b/vespalib/src/tests/shared_string_repo/shared_string_repo_test.cpp index 81c8271f755..5b267c3b9e9 100644 --- a/vespalib/src/tests/shared_string_repo/shared_string_repo_test.cpp +++ b/vespalib/src/tests/shared_string_repo/shared_string_repo_test.cpp @@ -101,8 +101,8 @@ std::unique_ptr<Handles> copy_strong_handles(const Handles &handles) { return result; } -std::unique_ptr<std::vector<string_id>> make_weak_handles(const Handles &handles) { - return std::make_unique<std::vector<string_id>>(handles.view()); +std::unique_ptr<StringIdVector> make_weak_handles(const Handles &handles) { + return std::make_unique<StringIdVector>(handles.view()); } //----------------------------------------------------------------------------- @@ -202,7 +202,7 @@ struct Fixture { std::vector<vespalib::string> get_direct_result; std::unique_ptr<Handles> strong; std::unique_ptr<Handles> strong_copy; - std::unique_ptr<std::vector<string_id>> weak; + std::unique_ptr<StringIdVector> weak; auto copy_strings_task = [&](){ copy_strings_result = copy_strings(work); }; auto copy_and_hash_task = [&](){ copy_and_hash_result = copy_and_hash(work); }; auto local_enum_task = [&](){ local_enum_result = local_enum(work); }; diff --git a/vespalib/src/vespa/vespalib/util/shared_string_repo.h b/vespalib/src/vespa/vespalib/util/shared_string_repo.h index ec65b942d88..d5faa0dfb0d 100644 --- a/vespalib/src/vespa/vespalib/util/shared_string_repo.h +++ b/vespalib/src/vespa/vespalib/util/shared_string_repo.h @@ -291,7 +291,7 @@ public: // A collection of string handles with ownership class Handles { private: - std::vector<string_id> _handles; + StringIdVector _handles; public: Handles(); Handles(Handles &&rhs); @@ -309,7 +309,7 @@ public: string_id id = _repo.copy(handle); _handles.push_back(id); } - const std::vector<string_id> &view() const { return _handles; } + const StringIdVector &view() const { return _handles; } }; }; diff --git a/vespalib/src/vespa/vespalib/util/string_id.h b/vespalib/src/vespa/vespalib/util/string_id.h index 7a72feee64a..7fec1da0bb8 100644 --- a/vespalib/src/vespa/vespalib/util/string_id.h +++ b/vespalib/src/vespa/vespalib/util/string_id.h @@ -2,7 +2,8 @@ #pragma once -#include <cstdint> +#include <vespa/vespalib/stllike/allocator.h> +#include <vector> namespace vespalib { @@ -38,4 +39,6 @@ public: constexpr bool operator!=(const string_id &rhs) const noexcept { return (_id != rhs._id); } }; +using StringIdVector = std::vector<string_id, vespalib::allocator_large<string_id>>; + } |