OmniSciDB  a7179b2938
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
type_name_to_string.h File Reference
#include <string_view>
+ Include dependency graph for type_name_to_string.h:

Go to the source code of this file.

Functions

template<typename T >
constexpr auto type_name () noexcept
 
template<auto E>
constexpr auto enum_name () noexcept
 

Function Documentation

template<auto E>
constexpr auto enum_name ( )
noexcept

Definition at line 32 of file type_name_to_string.h.

References setup::name, and anonymous_namespace{RelAlgTranslatorGeo.cpp}::suffix().

32  {
33  static_assert(std::is_enum_v<decltype(E)>);
34  std::string_view name = "Error: unsupported compiler", prefix, suffix;
35 #ifdef __clang__
36  name = __PRETTY_FUNCTION__;
37  prefix = "auto enum_name() [E = ";
38  suffix = "]";
39 #elif defined(__GNUC__)
40  name = __PRETTY_FUNCTION__;
41  prefix = "constexpr auto enum_name() [with auto E = ";
42  suffix = "]";
43 #elif defined(_MSC_VER)
44  name = __FUNCSIG__;
45  prefix = "auto __cdecl enum_name<";
46  suffix = ">(void) noexcept";
47 #endif
48  name.remove_prefix(prefix.size());
49  name.remove_suffix(suffix.size());
50  if (const auto pos = name.find_last_of(":)"); pos != std::string_view::npos)
51  name.remove_prefix(pos + 1);
52  return name;
53 }
string name
Definition: setup.py:35

+ Here is the call graph for this function:

template<typename T >
constexpr auto type_name ( )
noexcept

Definition at line 11 of file type_name_to_string.h.

References setup::name, and anonymous_namespace{RelAlgTranslatorGeo.cpp}::suffix().

Referenced by CodeGenerator::codegenCastBetweenIntTypesOverflowChecks().

11  {
12  std::string_view name = "Error: unsupported compiler", prefix, suffix;
13 #ifdef __clang__
14  name = __PRETTY_FUNCTION__;
15  prefix = "auto type_name() [T = ";
16  suffix = "]";
17 #elif defined(__GNUC__)
18  name = __PRETTY_FUNCTION__;
19  prefix = "constexpr auto type_name() [with T = ";
20  suffix = "]";
21 #elif defined(_MSC_VER)
22  name = __FUNCSIG__;
23  prefix = "auto __cdecl type_name<";
24  suffix = ">(void) noexcept";
25 #endif
26  name.remove_prefix(prefix.size());
27  name.remove_suffix(suffix.size());
28  return name;
29 }
string name
Definition: setup.py:35

+ Here is the call graph for this function:

+ Here is the caller graph for this function: