/* Copyright (C) 2021 * swift project Community / Contributors * * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, * or distributed except according to the terms contained in the LICENSE file. */ //! \file #include "blackmisc/sequence.h" #include namespace BlackMisc::Private { QVector findIndices(int size, const std::function &predicate) { QVector result(size); std::iota(result.begin(), result.end(), 0); result.erase(std::remove_if(result.begin(), result.end(), std::not_fn(predicate)), result.end()); return result; } QVector sortIndices(int size, const std::function &cmp) { QVector result(size); std::iota(result.begin(), result.end(), 0); std::sort(result.begin(), result.end(), cmp); return result; } }