fix testspr

This commit is contained in:
bolero-MURAKAMI 2017-10-11 16:46:53 +09:00
parent 7784046f95
commit 64e1994734
2 changed files with 29 additions and 16 deletions

View file

@ -162,7 +162,7 @@ namespace testspr {
return func_ == nullptr ? rhs == nullptr
: rhs == nullptr ? false
: func_.target_type() == rhs.target_type()
&& func_.target<bool (testspr::trace_stack const&)>() == rhs.target<bool (testspr::trace_stack const&)>()
&& func_.target<bool (*)(testspr::trace_stack const&)>() == rhs.target<bool (*)(testspr::trace_stack const&)>()
;
}
SPROUT_NON_CONSTEXPR bool operator!=(function_type const& rhs) const {

View file

@ -39,10 +39,10 @@ namespace testspr {
};
//
// typename_of
// demangle
//
namespace detail {
#ifdef TESTSPR_HAS_CXXABI_H
namespace detail {
inline SPROUT_NON_CONSTEXPR char*
demangle_alloc(char const* name) {
int status = 0;
@ -66,9 +66,11 @@ namespace testspr {
return demangled_;
}
};
} // namespace detail
inline SPROUT_NON_CONSTEXPR std::string
demangle(char const* name) {
scoped_demangled_name demangled(name);
testspr::detail::scoped_demangled_name demangled(name);
return demangled.get() ? demangled.get() : name;
}
#else
@ -77,16 +79,27 @@ namespace testspr {
return name;
}
#endif
} // namespace detail
inline SPROUT_NON_CONSTEXPR std::string
demangle(std::string const& name) {
return testspr::demangle(name.c_str());
}
//
// typename_of
//
inline SPROUT_NON_CONSTEXPR std::string
typename_of(std::type_info const& t) {
return testspr::demangle(t.name());
}
template<typename T>
inline SPROUT_NON_CONSTEXPR std::string
typename_of() {
return testspr::detail::demangle(typeid(T).name());
return testspr::typename_of(typeid(T));
}
template<typename T>
inline SPROUT_NON_CONSTEXPR std::string
typename_of(T&& t) {
return testspr::detail::demangle(typeid(std::forward<T>(t)).name());
return testspr::typename_of(typeid(std::forward<T>(t)));
}
//