aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/clickhouse/client/columns/utils.h
blob: fc43828c63c8d90ced734cddca2f03b49a6df9a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#pragma once

#include <algorithm>
#include <util/generic/vector.h>

namespace NClickHouse {
    template <typename T>
    TVector<T> SliceVector(const TVector<T>& vec, size_t begin, size_t len) {
        TVector<T> result;

        if (begin < vec.size()) {
            len = std::min(len, vec.size() - begin);
            result.assign(vec.begin() + begin, vec.begin() + (begin + len));
        }

        return result;
    }

}