userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
meta_light.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/utils/meta_light.hpp
4
/// @brief Lightweight concepts
5
/// @see userver/utils/meta.hpp for more concepts
6
/// @ingroup userver_universal
7
8
// Don't add new includes here! Put concepts that require them in meta.hpp.
9
#
include
<
type_traits
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
meta
{
14
15
namespace
impl {
16
17
template
<
template
<
typename
...>
typename
Template,
typename
T>
18
struct
IsInstantiationOf : std::false_type {};
19
20
template
<
template
<
typename
...>
typename
Template,
typename
... Args>
21
struct
IsInstantiationOf<Template, Template<Args...>> : std::true_type {};
22
23
}
// namespace impl
24
25
/// @brief Returns `true` if the type is an instantiation of the specified template.
26
template
<
typename
T,
template
<
typename
...>
typename
Template>
27
concept
IsInstantiationOf = impl::IsInstantiationOf<Template, T>::value;
28
29
/// @brief Returns `true` if the type (with remove cv-qualifiers) is an instantiation of the specified template.
30
template
<
typename
T,
template
<
typename
...>
typename
Template>
31
concept
IsCvInstantiationOf = IsInstantiationOf<std::remove_cv_t<T>, Template>;
32
33
/// Returns `true` if the type is a fundamental character type.
34
/// `signed char` and `unsigned char` are not character types.
35
template
<
typename
T>
36
concept
IsCharacter =
37
std::is_same_v<T,
char
> || std::is_same_v<T,
wchar_t
> || std::is_same_v<T,
char16_t
> || std::is_same_v<T,
char32_t
>;
38
39
/// Returns `true` if the type is a true integer type (not `*char*` or `bool`)
40
/// `signed char` and `unsigned char` are integer types
41
template
<
typename
T>
42
concept
IsInteger = std::is_integral_v<T> && !IsCharacter<T> && !std::is_same_v<T,
bool
>;
43
44
}
// namespace meta
45
46
USERVER_NAMESPACE_END
userver
utils
meta_light.hpp
Generated on
for userver by
Doxygen
1.17.0