SeqAn3
The Modern C++ library for sequence analysis.
type_inspection.hpp
Go to the documentation of this file.
1
// -----------------------------------------------------------------------------------------------------
2
// Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin
3
// Copyright (c) 2016-2019, Knut Reinert & MPI für molekulare Genetik
4
// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5
// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6
// -----------------------------------------------------------------------------------------------------
7
13
#pragma once
14
15
#if defined(__GNUC__) || defined(__clang__)
16
#include <cxxabi.h>
17
#endif // defined(__GNUC__) || defined(__clang__)
18
19
#include <
functional
>
20
#include <
memory
>
21
#include <
string
>
22
#include <
typeinfo
>
23
24
#include <
seqan3/core/platform.hpp
>
25
26
namespace
seqan3::detail
27
{
28
43
template
<
typename
type>
44
inline
static
const
std::string
type_name_as_string = [] ()
45
{
46
#if defined(__GNUC__) || defined(__clang__) // clang and gcc only return a mangled name.
47
using
safe_ptr_t =
std::unique_ptr
<char,
std::function
<void(
char
*)>>;
48
49
int
status
{};
50
safe_ptr_t demangled_name_ptr{abi::__cxa_demangle(
typeid
(type).name(), 0, 0, &status),
51
[] (
char
* name_ptr) {
free
(name_ptr); }};
52
return
std::string
{
std::addressof
(*demangled_name_ptr)};
53
#else // e.g. MSVC
54
return
typeid
(type).name();
55
#endif // defined(__GNUC__) || defined(__clang__)
56
}();
57
58
}
// namespace seqan3::detail
std::string
functional
std::function
std::addressof
T addressof(T... args)
memory
std::experimental::filesystem::status
T status(T... args)
platform.hpp
Provides platform and dependency checks.
std::free
T free(T... args)
typeinfo
std::unique_ptr
string
seqan3
core
detail
type_inspection.hpp
Generated on Mon Jan 13 2020 14:41:25 for SeqAn3 by
1.8.16