Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dziegel committed Aug 23, 2024
1 parent bd4e965 commit fe560ce
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions include/cpp_event_framework/DemangledTypeName.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,21 @@

namespace cpp_event_framework
{
/**
* @brief Convert a string view to a std::array
*
* @tparam Idxs
*/
template <std::size_t... Idxs>
constexpr auto SubstringAsArray(std::string_view str, std::index_sequence<Idxs...> /*idx*/)
{
return std::array{str[Idxs]..., '\0'};
}

/**
* @brief Convert type name to std::array
*
*/
template <typename T>
constexpr auto TypeNameArray()
{
Expand Down Expand Up @@ -54,12 +63,26 @@ constexpr auto TypeNameArray()
return SubstringAsArray(kName, std::make_index_sequence<kName.size()>{});
}

/**
* @brief Static storage for type name class
*
*/
template <typename T>
struct TypeNameHolder
{
/**
* @brief Static storage for type name
*
*/
static constexpr auto kValue = TypeNameArray<T>();
};

/**
* @brief Get the Demangled type name as NULL terminated const char*
*
* @tparam T
* @return constexpr const char*
*/
template <typename T>
constexpr const char* GetDemangledTypeName()
{
Expand Down

0 comments on commit fe560ce

Please sign in to comment.