userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
strong_typedef_fwd.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/utils/strong_typedef_fwd.hpp
4
/// @brief Forward declarations and options for StrongTypedef.
5
/// @ingroup userver_universal
6
7
#
include
<
type_traits
>
8
9
USERVER_NAMESPACE_BEGIN
10
11
namespace
utils
{
12
13
enum
class
StrongTypedefOps {
14
kNoCompare = 0,
/// Forbid all comparisons for StrongTypedef
15
16
kCompareStrong = 1,
/// Allow comparing two StrongTypedef<Tag, T>
17
kCompareTransparentOnly = 2,
/// Allow comparing StrongTypedef<Tag, T> and T
18
kCompareTransparent = 3,
/// Allow both of the above
19
20
kNonLoggable = 4,
/// Forbid logging and serializing for StrongTypedef
21
};
22
23
template
<
class
Tag,
class
T, StrongTypedefOps Ops = StrongTypedefOps::kCompareStrong>
24
class
StrongTypedef;
25
26
// Helpers
27
namespace
impl::strong_typedef {
28
29
struct
StrongTypedefTag {};
30
31
template
<
typename
T>
32
concept
IsStrongTypedef = std::is_base_of_v<StrongTypedefTag, T> && std::is_convertible_v<T&, StrongTypedefTag&>;
33
34
}
// namespace impl::strong_typedef
35
36
template
<
typename
T>
37
using
IsStrongTypedef = std::bool_constant<impl::strong_typedef::IsStrongTypedef<T>>;
38
39
}
// namespace utils
40
41
USERVER_NAMESPACE_END
userver
utils
strong_typedef_fwd.hpp
Generated on
for userver by
Doxygen
1.17.0