forked from andreasfertig/cppinsights
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InsightsStrongTypes.h
33 lines (30 loc) · 1.24 KB
/
InsightsStrongTypes.h
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
/******************************************************************************
*
* C++ Insights, copyright (C) by Andreas Fertig
* Distributed under an MIT license. See LICENSE for details
*
****************************************************************************/
#ifndef INSIGHTS_STRONG_TYPES
#define INSIGHTS_STRONG_TYPES
/// \brief A more than simple typsafe \c bool
///
/// This macro creates a class enum with two enumerators:
/// - \c No
/// - \c Yes
///
/// Usage:
/// \code
/// STRONG_BOOL(AddNewLine);
/// void Foo(AddNewLine);
/// ...
/// void Bar() {
/// Foo(AddNewLine::Yes);
/// }
/// \endcode
#define STRONG_BOOL(typeName) \
enum class typeName : bool \
{ \
No = false, \
Yes = true \
}
#endif /* INSIGHTS_STRONG_TYPES */