repr
0.1
Reconstructable string representations and more
Toggle main menu visibility
Main Page
Installation
Usage
Customization
Extending
FAQ
CI Results
Test
Benchmark
API Documentation
Namespace List
Namespace List
Namespace Members
All
_
a
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Functions
_
a
c
d
e
f
g
i
l
m
n
o
r
s
t
u
v
w
Variables
Typedefs
Enumerations
Concept List
Class List
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
_
a
c
e
f
g
i
l
m
n
o
p
r
s
t
v
w
~
Variables
a
b
c
d
e
f
g
i
k
l
m
n
o
p
q
r
s
t
u
v
Typedefs
a
c
d
e
f
g
h
l
m
p
r
s
t
u
v
w
Enumerations
Enumerator
Related Symbols
File List
File List
File Members
All
_
l
n
o
r
u
Variables
Macros
_
l
o
r
u
Examples
Source Code
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Concepts
Loading...
Searching...
No Matches
ctvi/ctvi.h
Go to the documentation of this file.
#pragma once
#include <
cstddef
>
#include <
string_view
>
#include <
librepr/macro/platform.h
>
#include <
librepr/macro/warning.h
>
#include <
librepr/util/string/const_string.h
>
namespace
librepr::ctvi
{
#if USING(LIBREPR_COMPILER_CLANG) && __has_warning("-Wenum-constexpr-conversion")
LIBREPR_WARNING_PUSH
// https://github.com/llvm/llvm-project/issues/68489
LIBREPR_WARNING_DISABLE_CLANG
(
"-Wenum-constexpr-conversion"
)
#endif
namespace
detail {
template
<auto V>
[[
nodiscard
]]
constexpr
auto
get_ctvi
()
noexcept
{
#if USING(LIBREPR_COMPILER_MSVC)
constexpr
auto
prefix =
std::string_view
{
"get_ctvi<"
};
constexpr
auto
suffix =
std::string_view
{
">(void)"
};
#else
constexpr
auto
prefix =
std::string_view
{
"V = "
};
constexpr
auto
suffix =
std::string_view
{
"]"
};
#endif
constexpr
auto
signature
=
std::string_view
{
LIBREPR_FUNCTION_NAME
};
constexpr
std::size_t
start =
signature
.find(prefix) + prefix.size();
constexpr
std::size_t
end =
signature
.find(suffix, start);
constexpr
auto
value
=
signature
.substr(start, end - start);
return
const_string
<
value
.
size
()>(
value
);
}
[[
nodiscard
]]
constexpr
auto
get_ctvi
()
noexcept
{
…
}
template
<
typename
T, auto M>
constexpr
auto
name_from_subobject
() {
constexpr
auto
raw
=
std::string_view
{
LIBREPR_FUNCTION_NAME
};
#if USING(LIBREPR_COMPILER_CLANG)
constexpr
auto
start_marker
=
std::string_view
{
"."
};
constexpr
auto
end_marker
=
std::string_view
{
"}]"
};
#elif USING(LIBREPR_COMPILER_MSVC)
constexpr
auto
start_marker
=
std::string_view
{
"->"
};
constexpr
auto
end_marker
=
std::string_view
{
">(void)"
};
#else
constexpr
auto
start_marker
=
std::string_view
{
"::"
};
constexpr
auto
end_marker
=
std::string_view
{
")]"
};
#endif
constexpr
auto
name =
std::string_view
{
raw
.begin() +
raw
.rfind(
start_marker
) +
start_marker
.length(),
raw
.end() -
end_marker
.size()};
return
librepr::const_string
<name.length()>(name);
}
constexpr
auto
name_from_subobject
() {
…
}
#if !USING(LIBREPR_COMPILER_MSVC)
template
<auto P>
consteval
auto
name_from_member_ptr
() {
constexpr
auto
raw
=
std::string_view
{
__PRETTY_FUNCTION__
};
constexpr
auto
start_marker
=
std::string_view
{
"::"
};
constexpr
auto
end_marker
=
std::string_view
{
"]"
};
constexpr
auto
name =
std::string_view
{
raw
.begin() +
raw
.rfind(
start_marker
) +
start_marker
.length(),
raw
.end() -
end_marker
.size()};
return
librepr::const_string
<name.length()>(name);
}
consteval
auto
name_from_member_ptr
() {
…
}
#endif
}
// namespace detail
namespace
detail {
…
}
template
<auto V>
constexpr
inline
auto
value
= detail::get_ctvi<V>();
#if USING(LIBREPR_COMPILER_CLANG) && __has_warning("-Wenum-constexpr-conversion")
LIBREPR_WARNING_POP
#endif
}
// namespace librepr::ctvi
namespace
librepr::ctvi
{
…
}
include
librepr
ctvi
ctvi.h
Generated by
1.9.8, using the excellent
Doxygen Awesome
Theme