tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
make_unsigned.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_TYPE_TRAITS_MAKE_UNSIGNED_HPP
5#define TETL_TYPE_TRAITS_MAKE_UNSIGNED_HPP
6
7namespace etl {
8
9namespace detail {
10
11template <typename>
12struct make_unsigned;
13
14template <>
15struct make_unsigned<signed char> {
16 using type = unsigned char;
17};
18
19template <>
20struct make_unsigned<signed short> {
21 using type = unsigned short;
22};
23
24template <>
25struct make_unsigned<signed int> {
26 using type = unsigned int;
27};
28
29template <>
30struct make_unsigned<signed long> {
31 using type = unsigned long;
32};
33
34template <>
35struct make_unsigned<signed long long> {
36 using type = unsigned long long;
37};
38
39template <>
40struct make_unsigned<unsigned char> {
41 using type = unsigned char;
42};
43
44template <>
45struct make_unsigned<unsigned short> {
46 using type = unsigned short;
47};
48
49template <>
50struct make_unsigned<unsigned int> {
51 using type = unsigned int;
52};
53
54template <>
55struct make_unsigned<unsigned long> {
56 using type = unsigned long;
57};
58
59template <>
60struct make_unsigned<unsigned long long> {
61 using type = unsigned long long;
62};
63
64} // namespace detail
65
66/// \brief If T is an integral (except bool) or enumeration type, provides the
67/// member typedef type which is the unsigned integer type corresponding to T,
68/// with the same cv-qualifiers. If T is signed or unsigned char, short, int,
69/// long, long long; the unsigned type from this list corresponding to T is
70/// provided. The behavior of a program that adds specializations for
71/// make_unsigned is undefined.
72template <typename Type>
73struct make_unsigned : etl::detail::make_unsigned<Type> { };
74
75template <typename T>
76using make_unsigned_t = typename make_unsigned<T>::type;
77
78} // namespace etl
79
80#endif // TETL_TYPE_TRAITS_MAKE_UNSIGNED_HPP
Definition adjacent_find.hpp:9
If T is an integral (except bool) or enumeration type, provides the member typedef type which is the ...
Definition make_unsigned.hpp:73