aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/misc/cast.h
blob: e8654cc12229a39fdb70638d9244a62338c55209 (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
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include <library/cpp/yt/exception/exception.h>

namespace NYT {

////////////////////////////////////////////////////////////////////////////////

template <class T, class S>
constexpr bool CanFitSubtype();

template <class T, class S>
constexpr bool IsInIntegralRange(S value);

template <class T, class S>
constexpr bool TryIntegralCast(S value, T* result);

template <class T, class S>
T CheckedIntegralCast(S value);

////////////////////////////////////////////////////////////////////////////////

template <class T, class S>
constexpr bool TryEnumCast(S value, T* result);

template <class T, class S>
T CheckedEnumCast(S value);

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT

#define CAST_INL_H_
#include "cast-inl.h"
#undef CAST_INL_H_