aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/util/generation_hold_list.h
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-10-10 18:01:28 +0200
committerGitHub <noreply@github.com>2022-10-10 18:01:28 +0200
commit26d9e5da4de4425cbb75cd8fff4374053073b19d (patch)
treebab1c9ca156af7d94b3583d6244a1c09c72e2a81 /vespalib/src/vespa/vespalib/util/generation_hold_list.h
parent08f7a121fff008dd1307b106bd1b7d7a84433fe6 (diff)
parentab10d27bd029f73d82dabd1f3fdb839edae29e61 (diff)
Merge pull request #24380 from vespa-engine/geirst/generation-holder-new-implv8.66.20
Implement GenerationHolder in terms of the generic generation hold list.
Diffstat (limited to 'vespalib/src/vespa/vespalib/util/generation_hold_list.h')
-rw-r--r--vespalib/src/vespa/vespalib/util/generation_hold_list.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/vespalib/src/vespa/vespalib/util/generation_hold_list.h b/vespalib/src/vespa/vespalib/util/generation_hold_list.h
index 5e12cb72bbd..b2f90934e84 100644
--- a/vespalib/src/vespa/vespalib/util/generation_hold_list.h
+++ b/vespalib/src/vespa/vespalib/util/generation_hold_list.h
@@ -14,7 +14,7 @@ namespace vespalib {
*
* This class must be used in accordance with a GenerationHandler.
*/
-template <typename T, bool track_bytes_held>
+template <typename T, bool track_bytes_held, bool use_deque>
class GenerationHoldList {
private:
using generation_t = vespalib::GenerationHandler::generation_t;
@@ -30,7 +30,9 @@ private:
};
using ElemList = std::vector<T>;
- using ElemWithGenList = std::deque<ElemWithGen>;
+ using ElemWithGenList = std::conditional_t<use_deque,
+ std::deque<ElemWithGen>,
+ std::vector<ElemWithGen>>;
ElemList _phase_1_list;
ElemWithGenList _phase_2_list;
@@ -46,6 +48,7 @@ private:
public:
GenerationHoldList();
+ ~GenerationHoldList();
/**
* Insert the given data element on this hold list.