1
0
forked from Alepha/Alepha

Fancy type name facility.

This commit is contained in:
2023-11-11 23:58:11 -05:00
parent 57511b2588
commit 50cc5b2857
3 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,4 @@
target_sources( alepha PRIVATE
fancyTypeName.cc
)

14
Utility/fancyTypeName.cc Normal file
View File

@ -0,0 +1,14 @@
static_assert( __cplusplus > 2020'99 );
#include "fancyTypeName.h"
#include <boost/core/demangle.hpp>
namespace Alepha::Hydrogen::Utility::detail::fancyTypeName_m
{
std::string
fancyTypeName( const std::type_index idx )
{
return boost::core::demangle( idx.name() );
}
}

23
Utility/fancyTypeName.h Normal file
View File

@ -0,0 +1,23 @@
static_assert( __cplusplus > 2020'99 );
#pragma once
#include <Alepha/Alepha.h>
#include <string>
#include <typeindex>
namespace Alepha::Hydrogen::Utility ::detail:: fancyTypeName_m
{
inline namespace exports
{
std::string fancyTypeName( std::type_index );
template< typename T > std::string fancyTypeName() { return fancyTypeName( typeid( T ) ); }
}
}
namespace Alepha::Hydrogen::Utility::inline exports::inline fancyTypeName_m
{
using namespace detail::fancyTypeName_m::exports;
}