+
Namespaces
Namespace List
+
Namespace Members
+
All
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
w
+
Functions
a
c
d
e
f
i
m
n
o
r
s
t
Variables
+
Typedefs
a
b
c
d
e
f
g
l
m
n
o
p
r
s
t
u
w
Enumerations
Enumerator
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
+
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
+
Variables
c
d
e
f
h
i
l
m
n
p
s
t
u
v
w
Typedefs
Related Functions
+
Files
File List
+
File Members
+
All
_
a
b
f
i
t
+
Functions
_
f
t
Variables
+
Macros
a
b
i
t
Related Pages
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
main
cpp
Balau
Util
Enums.hpp
Go to the documentation of this file.
1
// @formatter:off
2
//
3
// Balau core C++ library
4
//
5
// Copyright (C) 2008 Bora Software (contact@borasoftware.com)
6
//
7
// Licensed under the Boost Software License - Version 1.0 - August 17th, 2003.
8
// See the LICENSE file for the full license text.
9
//
10
16
17
#ifndef COM_BORA_SOFTWARE__BALAU_UTIL__ENUMS
18
#define COM_BORA_SOFTWARE__BALAU_UTIL__ENUMS
19
20
#include <type_traits>
21
22
namespace
Balau::Util
{
23
27
struct
Enums
final {
31
template
<
typename
E>
static
constexpr
auto
toUnderlying
(E e) noexcept ->
typename
std::underlying_type<E>::type
32
{
33
return
static_cast<
typename std::underlying_type<E>::type
>
(e);
34
}
35
37
38
Enums
() =
delete
;
39
Enums
(
const
Enums
&) =
delete
;
40
Enums
& operator = (
const
Enums
&) =
delete
;
41
};
42
43
}
// namespace Balau::Util
44
45
#endif // COM_BORA_SOFTWARE__BALAU_UTIL__ENUMS
Balau::Util
Utility functions.
Balau::Util::Enums::toUnderlying
static constexpr auto toUnderlying(E e) noexcept -> typename std::underlying_type< E >::type
Convert the strongly typed enum to its underlying integer.
Definition:
Enums.hpp:31
Balau::Util::Enums
Utilities for enums.
Definition:
Enums.hpp:27