aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/coroutine/engine/sockmap.h
blob: fd189e177469cdac850432da71f9720a748e44dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

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

template <class T>
class TSocketMap {
public:
    T& Get(size_t idx) {
        if (idx < 128000) {
            if (V_.size() <= idx) {
                V_.resize(idx + 1);
            }

            return V_[idx];
        }

        return H_[idx];
    }

private:
    TVector<T> V_;
    THashMap<size_t, T> H_;
};