mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-05-12 09:33:30 +00:00
fix testspr::print_type
This commit is contained in:
parent
59c5e7874c
commit
481b277216
10 changed files with 616 additions and 591 deletions
|
@ -119,7 +119,7 @@ namespace testspr {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline SPROUT_NON_CONSTEXPR void
|
inline SPROUT_NON_CONSTEXPR void
|
||||||
print_type() {
|
print_type() {
|
||||||
testspr::print_typename<testspr::id<T> >();
|
testspr::print_ln(testspr::qualified_typename_of<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -88,6 +88,31 @@ namespace testspr {
|
||||||
typename_of(T&& t) {
|
typename_of(T&& t) {
|
||||||
return testspr::detail::demangle(typeid(std::forward<T>(t)).name());
|
return testspr::detail::demangle(typeid(std::forward<T>(t)).name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// strip_outer_template
|
||||||
|
//
|
||||||
|
inline SPROUT_NON_CONSTEXPR std::string
|
||||||
|
strip_outer_template(std::string const& s) {
|
||||||
|
std::string::size_type f = s.find('<');
|
||||||
|
if (f == std::string::npos) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
std::string::size_type l = s.rfind('>');
|
||||||
|
if (l == std::string::npos || f > l) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
return s.substr(f + 1, l - f - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// qualified_typename_of
|
||||||
|
//
|
||||||
|
template<typename T>
|
||||||
|
inline SPROUT_NON_CONSTEXPR std::string
|
||||||
|
qualified_typename_of() {
|
||||||
|
return testspr::strip_outer_template(testspr::typename_of<testspr::id<T> >());
|
||||||
|
}
|
||||||
} // namespace testspr
|
} // namespace testspr
|
||||||
|
|
||||||
#endif // #ifndef TESTSPR_TYPEINFO_HPP
|
#endif // #ifndef TESTSPR_TYPEINFO_HPP
|
||||||
|
|
Loading…
Add table
Reference in a new issue