aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yson_pull/detail/traits.h
blob: 869a3b9c4485e18236f31bea30af7aa55ca4c433 (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
#pragma once

#include <type_traits>

namespace NYsonPull {
    namespace NDetail {
        namespace NTraits {
            template <typename T, typename U>
            using if_signed = typename std::enable_if<
                std::is_signed<T>::value,
                U>::type;

            template <typename T, typename U>
            using if_unsigned = typename std::enable_if<
                std::is_unsigned<T>::value,
                U>::type;

            template <typename T>
            using to_unsigned = typename std::enable_if<
                std::is_signed<T>::value,
                typename std::make_unsigned<T>::type>::type;

            template <typename T>
            using to_signed = typename std::enable_if<
                std::is_unsigned<T>::value,
                typename std::make_signed<T>::type>::type;
        }
    }     // namespace NDetail
}