CPP-ARGON
4.0.1
Command-Line Argument Parser for C++20
Loading...
Searching...
No Matches
typing.hpp
Go to the documentation of this file.
1
// Copyright (c) 2023-2026 Jakub Musiał
2
// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
3
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
4
10
#pragma once
11
12
#include <functional>
13
#include <memory>
14
#include <optional>
15
#include <source_location>
16
#include <string_view>
17
18
namespace
argon::util
{
19
28
template
<
typename
T>
29
constexpr
std::string_view
get_demangled_type_name
() {
30
#if defined(__clang__) || defined(__GNUC__)
31
constexpr
std::string_view
func_name
=
__PRETTY_FUNCTION__
;
32
constexpr
std::string_view
begin_key
=
"T = "
;
33
constexpr
std::string_view
end_key
=
";]"
;
34
35
auto
start_pos
=
func_name
.find(
begin_key
) +
begin_key
.size();
36
auto
end_pos
=
func_name
.find_first_of(
end_key
,
start_pos
);
37
return
func_name
.substr(
start_pos
,
end_pos
-
start_pos
);
38
#elif defined(_MSC_VER)
39
constexpr
std::string_view
func_name
=
__FUNCSIG__
;
40
constexpr
std::string_view
begin_key
=
"type_name<"
;
41
constexpr
char
end_key
=
'>'
;
42
43
auto
start_pos
=
func_name
.find(
begin_key
) +
begin_key
.size();
44
auto
end_pos
=
func_name
.find(
end_key
,
start_pos
);
45
return
func_name
.substr(
start_pos
,
end_pos
-
start_pos
);
46
#else
47
return
typeid
(
T
).name();
48
#endif
49
}
50
51
}
// namespace argon::util
argon::util::get_demangled_type_name
constexpr std::string_view get_demangled_type_name()
Retrieves the demangled name of a type T.
Definition
typing.hpp:29
argon::util
Definition
concepts.hpp:17
argon::argument_type::optional
@ optional
include
argon
util
typing.hpp
Generated on Fri Sep 18 2026 for CPP-ARGON by
1.9.8