// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "searchiterator.h" namespace search::queryeval { /** * Convenience for constructing MultiSearch::Children * holding them or passing ownership around. **/ class ChildrenIterators { private: std::vector _data; public: ChildrenIterators(std::vector data) : _data(std::move(data)) {} ChildrenIterators(ChildrenIterators && other) = default; size_t size() const noexcept { return _data.size(); } // convenience constructors for unit tests: template ChildrenIterators(SearchIterator::UP a, Args&&... args) { _data.reserve(1 + sizeof...(Args)); _data.push_back(std::move(a)); (_data.emplace_back(std::forward(args)), ...); } template ChildrenIterators(SearchIterator *a, Args&&... args) { _data.reserve(1 + sizeof...(Args)); _data.emplace_back(a); (_data.emplace_back(std::forward(args)), ...); } operator std::vector () && { return std::move(_data); } }; } // namespace