Buildfix on gcc 4.8

This commit is contained in:
King_DuckZ 2015-06-24 23:05:33 +02:00
commit 7140ee6b38
4 changed files with 34 additions and 28 deletions

View file

@ -19,6 +19,8 @@
# include "sprout/string.hpp"
# include "doorkeeper/implem/tiger_bt.hpp"
# include <stdexcept>
#else
# include <string>
#endif
#include "doorkeeper/implem/compatibility.h"
#include <cstdint>

View file

@ -24,8 +24,8 @@ namespace dk {
inline std::string type_name()
#endif
{
#if defined(IS_PRETTY_FUNC_CONSTEXPR)
# if defined(__GNUC__)
#if defined(__GNUC__)
# if defined(IS_PRETTY_FUNC_CONSTEXPR)
typedef sprout::string<implem::type_name_info<T>().len> sproutstring;
typedef sprout::string<implem::type_name_len<T>()> sproutstringret;
@ -37,7 +37,12 @@ namespace dk {
implem::type_name_len<T>() - 1
);
# else
# error "not implemented"
std::string pf(__PRETTY_FUNCTION__);
const auto read_start = pf.find('=', pf.find('[') + 1) + 2;
return pf.substr(
read_start,
pf.find(';', read_start) - read_start
);
# endif
#else
# error "not implemented"
@ -47,14 +52,18 @@ namespace dk {
}
namespace implem {
#if defined(IS_PRETTY_FUNC_CONSTEXPR)
template <typename T>
constexpr type_name_info<T>::type_name_info() :
# if defined(__GNUC__)
len(sizeof(__PRETTY_FUNCTION__)),
str(__PRETTY_FUNCTION__)
# else
# error "not implemented"
# endif
{
}
#if defined(IS_PRETTY_FUNC_CONSTEXPR)
template <typename T>
constexpr std::size_t type_name_len() {
typedef sprout::string<implem::type_name_info<T>().len> sproutstring;