OpenMS
Loading...
Searching...
No Matches
PeakContainerSort.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
12
13#include <algorithm>
14#include <numeric>
15#include <vector>
16
17namespace OpenMS
18{
19 namespace Internal
20 {
28 template<class Predicate>
29 std::vector<Size> stableSortedIndices(Size n, const Predicate& lambda)
30 {
31 std::vector<Size> indices(n);
32 std::iota(indices.begin(), indices.end(), 0);
33 std::stable_sort(indices.begin(), indices.end(), lambda);
34 return indices;
35 }
36 } // namespace Internal
37} // namespace OpenMS
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< Size > stableSortedIndices(Size n, const Predicate &lambda)
Implementation detail of the sort(Predicate) members of MSSpectrum, MSChromatogram and Mobilogram.
Definition PeakContainerSort.h:29
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19