diff options
Diffstat (limited to 'util/stream/multi_stream.hh')
-rw-r--r-- | util/stream/multi_stream.hh | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/util/stream/multi_stream.hh b/util/stream/multi_stream.hh index b1461f964..6381fc2ed 100644 --- a/util/stream/multi_stream.hh +++ b/util/stream/multi_stream.hh @@ -20,6 +20,9 @@ class ChainPositions : public util::FixedArray<util::stream::ChainPosition> { public: ChainPositions() {} + explicit ChainPositions(std::size_t bound) : + util::FixedArray<util::stream::ChainPosition>(bound) {} + void Init(Chains &chains); explicit ChainPositions(Chains &chains) { @@ -88,16 +91,6 @@ template <class T> class GenericStreams : public util::FixedArray<T> { public: GenericStreams() {} - // This puts a dummy T at the beginning (useful to algorithms that need to reference something at the beginning). - void InitWithDummy(const ChainPositions &positions) { - P::Init(positions.size() + 1); - new (P::end()) T(); // use "placement new" syntax to initalize T in an already-allocated memory location - P::Constructed(); - for (const util::stream::ChainPosition *i = positions.begin(); i != positions.end(); ++i) { - P::push_back(*i); - } - } - // Limit restricts to positions[0,limit) void Init(const ChainPositions &positions, std::size_t limit) { P::Init(limit); @@ -112,6 +105,10 @@ template <class T> class GenericStreams : public util::FixedArray<T> { GenericStreams(const ChainPositions &positions) { Init(positions); } + + void Init(std::size_t amount) { + P::Init(amount); + } }; template <class T> inline Chains &operator>>(Chains &chains, GenericStreams<T> &streams) { |