repr
0.1
Reconstructable string representations and more
Loading...
Searching...
No Matches
literal.h
Go to the documentation of this file.
1
#pragma once
2
#include <
cstddef
>
3
#include <
type_traits
>
4
5
namespace
librepr
{
6
7
template
<
typename
T>
8
struct
is_literal
{
9
// don't print type names for fundamental types and string literals
10
constexpr
static
bool
value
= std::is_fundamental_v<T> || std::is_same_v<T, char const*>;
11
};
12
13
template
<
typename
T, std::
size_t
N>
14
struct
is_literal
<T[
N
]> {
15
// don't print type names for arrays
16
constexpr
static
bool
value
=
true
;
17
};
18
19
template
<
typename
T>
20
requires
std::is_enum_v<T>
21
struct
is_literal
<T> {
22
// don't print type names for enums
23
constexpr
static
bool
value
=
true
;
24
};
25
26
template
<
typename
T>
27
inline
constexpr
bool
is_literal_v
=
is_literal<T>::value
;
28
}
cstddef
librepr
Definition
ctvi/ctvi.h:9
librepr::code_for
std::string code_for()
Definition
repr:39
librepr::is_literal_v
constexpr bool is_literal_v
Definition
literal.h:27
librepr::is_literal
Definition
literal.h:8
librepr::is_literal::value
static constexpr bool value
Definition
literal.h:10
type_traits
include
librepr
literal.h
Generated by
1.9.8, using the excellent
Doxygen Awesome
Theme